[Pkg-tcltk-commits] r1187 - in expect/trunk/debian: . patches

sgolovan at alioth.debian.org sgolovan at alioth.debian.org
Fri Nov 4 08:36:00 UTC 2011


Author: sgolovan
Date: 2011-11-04 08:36:00 +0000 (Fri, 04 Nov 2011)
New Revision: 1187

Modified:
   expect/trunk/debian/changelog
   expect/trunk/debian/patches/22-segfault-with-stubs.patch
Log:
[expect]
  * Replaced ckalloc() call in exp_clib.c by malloc() because using the
    ordinary free() leads to memory corruption after ckalloc() (which is
    a macro for Tcl_Alloc()). See patches/22-segfault-with-stubs.patch
    for segfaulting examples.


Modified: expect/trunk/debian/changelog
===================================================================
--- expect/trunk/debian/changelog	2011-11-01 15:20:49 UTC (rev 1186)
+++ expect/trunk/debian/changelog	2011-11-04 08:36:00 UTC (rev 1187)
@@ -1,8 +1,11 @@
-expect (5.45-2) UNRELEASED; urgency=low
+expect (5.45-2) unstable; urgency=low
 
-  * NOT RELEASED YET
+  * Replaced ckalloc() call in exp_clib.c by malloc() because using the
+    ordinary free() leads to memory corruption after ckalloc() (which is
+    a macro for Tcl_Alloc()). See patches/22-segfault-with-stubs.patch
+    for segfaulting examples.
 
- -- Sergei Golovan <sgolovan at debian.org>  Wed, 17 Aug 2011 22:21:48 +0400
+ -- Sergei Golovan <sgolovan at debian.org>  Fri, 04 Nov 2011 12:14:05 +0400
 
 expect (5.45-1) unstable; urgency=low
 

Modified: expect/trunk/debian/patches/22-segfault-with-stubs.patch
===================================================================
--- expect/trunk/debian/patches/22-segfault-with-stubs.patch	2011-11-01 15:20:49 UTC (rev 1186)
+++ expect/trunk/debian/patches/22-segfault-with-stubs.patch	2011-11-04 08:36:00 UTC (rev 1187)
@@ -15,6 +15,26 @@
      while ((datum = getc (pipe)) != EOF)
  	printf("%c",datum);
  }
+Example:
+ #include <stdio.h>
+ #include "expect.h"
+ main()
+ {
+     int fd = 0;
+     fd = exp_spawnl("echo", "echo", "Hello User: Whats up?", (char*) 0);
+     switch (exp_expectl(fd, exp_regexp, "ser:", 1, exp_end)) {
+ 	case 1: {
+ 	    printf("GOT ser:\n");
+ 	    break;
+ 	}
+ 	default: {
+ 	    printf("DEFAULT\n");
+ 	    return 1;
+ 	}
+     }
+     printf("Normal Exit\n");
+     return 0;
+ }
 
 --- expect-5.45.orig/exp_clib.c
 +++ expect-5.45/exp_clib.c
@@ -31,3 +51,21 @@
  #include "expect.h"
  #define TclRegError exp_TclRegError
  
+@@ -389,7 +389,7 @@
+ 		FAIL("regexp too big");
+ 
+ 	/* Allocate space. */
+-	r = (regexp *)ckalloc(sizeof(regexp) + (unsigned)rcstate->regsize);
++	r = (regexp *)malloc(sizeof(regexp) + (unsigned)rcstate->regsize);
+ 	if (r == NULL)
+ 		FAIL("out of space");
+ 
+@@ -399,7 +399,7 @@
+ 	rcstate->regcode = r->program;
+ 	regc(MAGIC, rcstate);
+ 	if (reg(0, &flags, rcstate) == NULL) {
+-	  ckfree ((char*) r);
++	  free ((char*) r);
+ 	  return(NULL);
+ 	}
+ 




More information about the Pkg-tcltk-commits mailing list