patch-engine_engine_c 833 B

1234567891011121314151617181920212223
  1. $OpenBSD: patch-engine_engine_c,v 1.4 2016/01/28 18:14:54 jasper Exp $
  2. Fix use of uninitalized memory. Found by malloc option J.
  3. http://git.savannah.gnu.org/cgit/gforth.git/commit/?id=4a03e4ff51314fc3a97acedeee928822b3bf1433
  4. --- engine/engine.c.orig Thu Jan 28 19:10:49 2016
  5. +++ engine/engine.c Thu Jan 28 19:10:54 2016
  6. @@ -409,12 +409,13 @@ Label *gforth_engine(Xt *ip0, Cell *sp0, Cell *rp0, Fl
  7. for (i=0; i<DOESJUMP+1; i++)
  8. xts[i] = symbols[i] = (Label)routines[i];
  9. for (; routines[i]!=0; i++) {
  10. - if (i>=MAX_SYMBOLS) {
  11. + if (i+1>=MAX_SYMBOLS) {
  12. fprintf(stderr,"gforth-ditc: more than %ld primitives\n",(long)MAX_SYMBOLS);
  13. exit(1);
  14. }
  15. xts[i] = symbols[i] = &routines[i];
  16. }
  17. + xts[i] = symbols[i] = 0;
  18. #endif /* defined(DOUBLY_INDIRECT) */
  19. #ifdef STANDALONE
  20. return image;