openbsd-ports/lang/gforth/patches/patch-engine_engine_c
jasper e759e42877 - sync engine.c with what's been committed upstream
- a variation of machine.h is committed upstream, well prepared for openbsd/mips32

no pkg change
2016-01-28 18:14:54 +00:00

23 lines
833 B
Plaintext

$OpenBSD: patch-engine_engine_c,v 1.4 2016/01/28 18:14:54 jasper Exp $
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;