Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3ea17d5f13644ef7f96de66e551bb49ef0da898ebd9dd2ad28c0601876cad207
Ticket: 7d47ba7d9497fda88c064b6152d3a2126c3cd9d2
Stack overruns in regexp code
User & Date: serhiy.storchaka on 2026-10-11 10:09:04
Changes

  1. icomment:
    A fixed limit cannot protect threads with smaller stacks: with a 1 MB stack, the branch crashed in <tt>duptraverse()</tt>. Now <tt>STACK_TOO_DEEP()</tt> also uses the real stack limit of the current thread where the system reports it (new internal <tt>TclpGetCStackLimit()</tt>: pthread_getattr_np, pthread_attr_get_np, pthread_get_stackaddr_np, pthread_stackseg_np, thr_stksegment, VirtualQuery), with <tt>REG_MAX_STACK_DEPTH</tt> as a cap. New test stack-4.1 runs deep REs with a 256 KB stack. Tested on Linux, Windows, FreeBSD, DragonFly, NetBSD, OpenBSD and OpenIndiana.
    
  2. login: "serhiy.storchaka"
  3. mimetype: "text/x-fossil-wiki"