ports/lang/gforth/patches/patch-engine_engine_c

20 lines
761 B
Text

Fix use of uninitalized memory. Found by malloc option J.
http://git.savannah.gnu.org/cgit/gforth.git/commit/?id=4a03e4ff51314fc3a97acedeee928822b3bf1433
--- engine/engine.c.orig Thu Jan 28 19:10:49 2016
+++ engine/engine.c Thu Jan 28 19:10:54 2016
@@ -409,12 +409,13 @@ Label *gforth_engine(Xt *ip0, Cell *sp0, Cell *rp0, Fl
for (i=0; i<DOESJUMP+1; i++)
xts[i] = symbols[i] = (Label)routines[i];
for (; routines[i]!=0; i++) {
- if (i>=MAX_SYMBOLS) {
+ if (i+1>=MAX_SYMBOLS) {
fprintf(stderr,"gforth-ditc: more than %ld primitives\n",(long)MAX_SYMBOLS);
exit(1);
}
xts[i] = symbols[i] = &routines[i];
}
+ xts[i] = symbols[i] = 0;
#endif /* defined(DOUBLY_INDIRECT) */
#ifdef STANDALONE
return image;