[gimp] Minor changes to minimize differences to official version of TinyScheme.
- From: Kevin Cozens <kcozens src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Minor changes to minimize differences to official version of TinyScheme.
- Date: Tue, 18 Aug 2009 14:52:03 +0000 (UTC)
commit 76155d79df8d497d9a5994029247387e222da9e9
Author: Kevin Cozens <kcozens cvs gnome org>
Date: Mon Aug 17 19:29:02 2009 -0400
Minor changes to minimize differences to official version of TinyScheme.
Fixed potential buffer overflow in readstr_upto().
plug-ins/script-fu/tinyscheme/scheme.c | 33 ++++++++++++++++---------------
plug-ins/script-fu/tinyscheme/scheme.h | 2 +-
2 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index 8bac854..2c793f7 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -1763,14 +1763,15 @@ static char *readstr_upto(scheme *sc, char *delim) {
char *p = sc->strbuff;
gunichar c = 0;
gunichar c_prev = 0;
- int len = 0;
+ int len = 0;
do {
c_prev = c;
c = inchar(sc);
len = g_unichar_to_utf8(c, p);
p += len;
- } while (c && !is_one_of(delim, c));
+ } while ((p - sc->strbuff < sizeof(sc->strbuff)) &&
+ (c && !is_one_of(delim, c)));
if(p == sc->strbuff+2 && c_prev == '\\')
*p = '\0';
@@ -2105,12 +2106,12 @@ static void atom2str(scheme *sc, pointer l, int f, char **pp, int *plen) {
default:
#if USE_ASCII_NAMES
if(c==127) {
- snprintf(p,STRBUFFSIZE,"#\\del");
+ snprintf(p,STRBUFFSIZE, "#\\del");
break;
} else if(c<32) {
- snprintf(p,STRBUFFSIZE,"#\\%s", charnames[c]);
+ snprintf(p,STRBUFFSIZE, "#\\%s", charnames[c]);
break;
- }
+ }
#else
if(c<32) {
snprintf(p,STRBUFFSIZE,"#\\x%x",c); break;
@@ -2725,7 +2726,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
if(sc->tracing) {
s_save(sc,OP_REAL_APPLY,sc->args,sc->code);
sc->print_flag = 1;
- /* sc->args=cons(sc,sc->code,sc->args);*/
+ /* sc->args=cons(sc,sc->code,sc->args);*/
putstr(sc,"\nApply to: ");
s_goto(sc,OP_P0LIST);
}
@@ -2837,7 +2838,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
case OP_SET0: /* set! */
if(is_immutable(car(sc->code)))
- Error_1(sc,"set!: unable to alter immutable variable", car(sc->code));
+ Error_1(sc,"set!: unable to alter immutable variable",car(sc->code));
s_save(sc,OP_SET1, sc->NIL, car(sc->code));
sc->code = cadr(sc->code);
s_goto(sc,OP_EVAL);
@@ -3661,11 +3662,11 @@ static int is_list(scheme *sc, pointer a) {
}
}
-int list_length(scheme *sc, pointer a) {
+int list_length(scheme *sc, pointer p) {
int i=0;
pointer slow, fast;
- slow = fast = a;
+ slow = fast = p;
while (1)
{
if (fast == sc->NIL)
@@ -4245,13 +4246,13 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) {
case OP_RDVEC:
/*sc->code=cons(sc,mk_proc(sc,OP_VECTOR),sc->value);
s_goto(sc,OP_EVAL); Cannot be quoted*/
- /*x=cons(sc,mk_proc(sc,OP_VECTOR),sc->value);
- s_return(sc,x); Cannot be part of pairs*/
- /*sc->code=mk_proc(sc,OP_VECTOR);
- sc->args=sc->value;
- s_goto(sc,OP_APPLY);*/
- sc->args=sc->value;
- s_goto(sc,OP_VECTOR);
+ /*x=cons(sc,mk_proc(sc,OP_VECTOR),sc->value);
+ s_return(sc,x); Cannot be part of pairs*/
+ /*sc->code=mk_proc(sc,OP_VECTOR);
+ sc->args=sc->value;
+ s_goto(sc,OP_APPLY);*/
+ sc->args=sc->value;
+ s_goto(sc,OP_VECTOR);
/* ========== printing part ========== */
case OP_P0LIST:
diff --git a/plug-ins/script-fu/tinyscheme/scheme.h b/plug-ins/script-fu/tinyscheme/scheme.h
index dc665b9..3f05ea8 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.h
+++ b/plug-ins/script-fu/tinyscheme/scheme.h
@@ -202,7 +202,7 @@ struct scheme_interface {
gunichar (*charvalue)(pointer p);
int (*is_list)(scheme *sc, pointer p);
int (*is_vector)(pointer p);
- int (*list_length)(scheme *sc, pointer a);
+ int (*list_length)(scheme *sc, pointer p);
long (*vector_length)(pointer vec);
void (*fill_vector)(pointer vec, pointer elem);
pointer (*vector_elem)(pointer vec, int ielem);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]