Added extra checks to stop bad syntax in LET*, LET, and LETREC from
2007-12-17 Kevin Cozens <kcozens@cvs.gnome.org> * plug-ins/script-fu/tinyscheme/scheme.c: Added extra checks to stop bad syntax in LET*, LET, and LETREC from causing a segmentation fault in Linux. See SourceForge bug #1817986. svn path=/trunk/; revision=24400
This commit is contained in:

committed by
Kevin Cozens

parent
3decfb47af
commit
6e476b9b4a
@ -1,3 +1,9 @@
|
||||
2007-12-17 Kevin Cozens <kcozens@cvs.gnome.org>
|
||||
|
||||
* plug-ins/script-fu/tinyscheme/scheme.c: Added extra checks to stop
|
||||
bad syntax in LET*, LET, and LETREC from causing a segmentation fault
|
||||
in Linux. See SourceForge bug #1817986.
|
||||
|
||||
2007-12-18 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* libgimpwidgets/gimpstock.h: fix typo that probably caused
|
||||
|
@ -287,6 +287,7 @@ INTERFACE INLINE void setimmutable(pointer p) { typeflag(p) |= T_IMMUTABLE; }
|
||||
#define cddr(p) cdr(cdr(p))
|
||||
#define cadar(p) car(cdr(car(p)))
|
||||
#define caddr(p) car(cdr(cdr(p)))
|
||||
#define cdaar(p) cdr(car(car(p)))
|
||||
#define cadaar(p) car(cdr(car(car(p))))
|
||||
#define cadddr(p) car(cdr(cdr(cdr(p))))
|
||||
#define cddddr(p) cdr(cdr(cdr(cdr(p))))
|
||||
@ -2761,6 +2762,9 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
|
||||
case OP_LET1: /* let (calculate parameters) */
|
||||
sc->args = cons(sc, sc->value, sc->args);
|
||||
if (is_pair(sc->code)) { /* continue */
|
||||
if (!is_pair(car(sc->code)) || !is_pair(cdar(sc->code))) {
|
||||
Error_1(sc,"Bad syntax of binding spec in let :",car(sc->code));
|
||||
}
|
||||
s_save(sc,OP_LET1, sc->args, cdr(sc->code));
|
||||
sc->code = cadar(sc->code);
|
||||
sc->args = sc->NIL;
|
||||
@ -2799,6 +2803,9 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
|
||||
sc->code = cdr(sc->code);
|
||||
s_goto(sc,OP_BEGIN);
|
||||
}
|
||||
if(!is_pair(car(sc->code)) || !is_pair(caar(sc->code)) || !is_pair(cdaar(sc->code))) {
|
||||
Error_1(sc,"Bad syntax of binding spec in let* :",car(sc->code));
|
||||
}
|
||||
s_save(sc,OP_LET1AST, cdr(sc->code), car(sc->code));
|
||||
sc->code = cadaar(sc->code);
|
||||
s_goto(sc,OP_EVAL);
|
||||
@ -2841,6 +2848,9 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) {
|
||||
case OP_LET1REC: /* letrec (calculate parameters) */
|
||||
sc->args = cons(sc, sc->value, sc->args);
|
||||
if (is_pair(sc->code)) { /* continue */
|
||||
if (!is_pair(car(sc->code)) || !is_pair(cdar(sc->code))) {
|
||||
Error_1(sc,"Bad syntax of binding spec in letrec :",car(sc->code));
|
||||
}
|
||||
s_save(sc,OP_LET1REC, sc->args, cdr(sc->code));
|
||||
sc->code = cadar(sc->code);
|
||||
sc->args = sc->NIL;
|
||||
|
Reference in New Issue
Block a user