Bug#338834: [PATCH] solve the on-exit crashing
Kees Cook
kees at outflux.net
Mon Sep 25 23:48:21 UTC 2006
The on-exit crash is actually a separate bug. Attached is a patch that
solves it.
--
Kees Cook @outflux.net
-------------- next part --------------
--- abuse-sdl-0.7.0/src/include/stack.hpp.orig 2006-09-25 16:06:06.090418255 -0700
+++ abuse-sdl-0.7.0/src/include/stack.hpp 2006-09-25 16:09:09.434419282 -0700
@@ -14,16 +14,22 @@ template<class T> class grow_stack
public :
T **sdata;
long son;
+ long smax;
- grow_stack(int max_size) { sdata=(T **)jmalloc(max_size,"pointer stack"); son=0; }
+ grow_stack(int max_size) {
+ smax=max_size;
+ son=0;
+ sdata=(T **)jmalloc(sizeof(T *)*smax,"pointer stack");
+ }
void push(T *data)
{
+ if (son>=smax) { lbreak("stack overflow (%ld)\n",smax); exit(1); }
sdata[son]=data;
son++;
}
T *pop(long total)
- { if (total>son) { lbreak("stack underflow\n"); exit(0); }
+ { if (total>son) { lbreak("stack underflow\n"); exit(1); }
son-=total;
return sdata[son];
}
More information about the Pkg-games-devel
mailing list