summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-25 19:51:38 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-25 19:51:38 +0000
commitbab2e6cfdf341baa65533be655563d5cb819f6ba (patch)
tree5a3a274aa3c4f18d1d13309699c01174c4466a82 /ext/syck/token.c
parent3d0d2d5ff1a75dcf32f455f306079f139269f280 (diff)
* ext/syck/token.c: removed YYTOKTMP references which
were causing buffer overflows on large block scalars, comments, quoted scalars and plain scalars. * ext/syck/rubyext.c: dynamic changing of buffer size. * ext/syck/syck.h: default buffer size of 4k. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index aa7771de752..f9e0601e526 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Thu Oct 16 14:12:55 2003 */
+/* Generated by re2c 0.5 on Tue Nov 25 12:10:28 2003 */
#line 1 "token.re"
/*
* token.re
@@ -119,7 +119,7 @@
#define RETURN_IMPLICIT() \
{ \
SyckNode *n = syck_alloc_str(); \
- YYCURSOR = YYTOKTMP; \
+ YYCURSOR = YYTOKEN; \
n->data.str->ptr = qstr; \
n->data.str->len = qidx; \
sycklval->nodeData = n; \
@@ -1387,7 +1387,7 @@ Plain:
GET_TRUE_YAML_INDENT(parentIndent);
Plain2:
- YYTOKTMP = YYCURSOR;
+ YYTOKEN = YYCURSOR;
Plain3:
@@ -1416,7 +1416,7 @@ yy111:
#line 488
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
- char *tok = YYTOKTMP;
+ char *tok = YYTOKEN;
GOBBLE_UP_YAML_INDENT( indt_len, tok );
lvl = CURRENT_LEVEL();
@@ -1425,9 +1425,9 @@ yy111:
RETURN_IMPLICIT();
}
- while ( YYTOKTMP < YYCURSOR )
+ while ( YYTOKEN < YYCURSOR )
{
- if ( is_newline( YYTOKTMP++ ) )
+ if ( is_newline( YYTOKEN++ ) )
nl_count++;
}
if ( nl_count <= 1 )
@@ -1452,7 +1452,7 @@ yy112: yych = *++YYCURSOR;
}
yy113:
#line 542
- { QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
+ { QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
goto Plain2;
}
yy114: yyaccept = 1;
@@ -1472,7 +1472,7 @@ yy116:
{
YYCURSOR--;
}
- QUOTECATS(qstr, qcapa, qidx, YYTOKTMP, YYCURSOR - YYTOKTMP);
+ QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
goto Plain2;
}
RETURN_IMPLICIT();
@@ -1568,7 +1568,7 @@ SingleQuote:
char *qstr = S_ALLOC_N( char, qcapa );
SingleQuote2:
- YYTOKTMP = YYCURSOR;
+ YYTOKEN = YYCURSOR;
{
YYCTYPE yych;
@@ -1593,7 +1593,7 @@ yy141:
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
+ GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_str )
@@ -1605,9 +1605,9 @@ yy141:
/* Error! */
}
- while ( YYTOKTMP < YYCURSOR )
+ while ( YYTOKEN < YYCURSOR )
{
- if ( is_newline( YYTOKTMP++ ) )
+ if ( is_newline( YYTOKEN++ ) )
nl_count++;
}
if ( nl_count <= 1 )
@@ -1701,7 +1701,7 @@ DoubleQuote:
char *qstr = S_ALLOC_N( char, qcapa );
DoubleQuote2:
- YYTOKTMP = YYCURSOR;
+ YYTOKEN = YYCURSOR;
{
@@ -1728,7 +1728,7 @@ yy157:
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
- GOBBLE_UP_YAML_INDENT( indt_len, YYTOKTMP );
+ GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_str )
@@ -1742,9 +1742,9 @@ yy157:
if ( keep_nl == 1 )
{
- while ( YYTOKTMP < YYCURSOR )
+ while ( YYTOKEN < YYCURSOR )
{
- if ( is_newline( YYTOKTMP++ ) )
+ if ( is_newline( YYTOKEN++ ) )
nl_count++;
}
if ( nl_count <= 1 )
@@ -1903,7 +1903,7 @@ yy175: yych = *++YYCURSOR;
yy176:
#line 693
{ long ch;
- char *chr_text = syck_strndup( YYTOKTMP, 4 );
+ char *chr_text = syck_strndup( YYTOKEN, 4 );
chr_text[0] = '0';
ch = strtol( chr_text, NULL, 16 );
free( chr_text );
@@ -2145,7 +2145,7 @@ ScalarBlock:
YYTOKEN = YYCURSOR;
ScalarBlock2:
- YYTOKTMP = YYCURSOR;
+ YYTOKEN = YYCURSOR;
{
YYCTYPE yych;
@@ -2168,7 +2168,7 @@ yy199: yyaccept = 0;
yy200:
#line 854
{ char *pacer;
- char *tok = YYTOKTMP;
+ char *tok = YYTOKEN;
int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
GOBBLE_UP_YAML_INDENT( indt_len, tok );
lvl = CURRENT_LEVEL();
@@ -2183,7 +2183,7 @@ yy200:
}
else if ( lvl->status != syck_lvl_block )
{
- YYCURSOR = YYTOKTMP;
+ YYCURSOR = YYTOKEN;
RETURN_YAML_BLOCK();
}
@@ -2196,7 +2196,7 @@ yy200:
fold_nl = 1;
}
- pacer = YYTOKTMP;
+ pacer = YYTOKEN;
while ( pacer < YYCURSOR )
{
if ( is_newline( pacer++ ) )
@@ -2227,7 +2227,7 @@ yy200:
if ( indt_len < lvl->spaces )
{
POP_LEVEL();
- YYCURSOR = YYTOKTMP;
+ YYCURSOR = YYTOKEN;
RETURN_YAML_BLOCK();
}
goto ScalarBlock2;
@@ -2239,7 +2239,7 @@ yy201: yych = *++YYCURSOR;
}
yy202:
#line 940
- { QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
+ { QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
goto ScalarBlock2;
}
yy203: yych = *++YYCURSOR;
@@ -2249,11 +2249,11 @@ yy204:
if ( lvl->status != syck_lvl_block )
{
eat_comments( parser );
- YYTOKTMP = YYCURSOR;
+ YYTOKEN = YYCURSOR;
}
else
{
- QUOTECAT(qstr, qcapa, qidx, *YYTOKTMP);
+ QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
}
goto ScalarBlock2;
}
@@ -2298,11 +2298,9 @@ yy211: YYCURSOR = YYMARKER;
void
eat_comments( SyckParser *parser )
{
- char *tok;
-
Comment:
{
- tok = YYCURSOR;
+ YYTOKEN = YYCURSOR;
{
YYCTYPE yych;
@@ -2320,8 +2318,8 @@ yy212:
}
yy214: yych = *++YYCURSOR;
yy215:
-#line 963
- { YYCURSOR = tok;
+#line 961
+ { YYCURSOR = YYTOKEN;
return;
}
yy216: yyaccept = 0;
@@ -2333,7 +2331,7 @@ yy217: yych = *++YYCURSOR;
default: goto yy218;
}
yy218:
-#line 967
+#line 965
{ goto Comment;
}
yy219: yych = *++YYCURSOR;
@@ -2359,7 +2357,7 @@ yy223: YYCURSOR = YYMARKER;
case 0: goto yy215;
}
}
-#line 970
+#line 968
}