ox 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ox might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +2 -6
- data/ext/ox/parse.c +45 -17
- data/ext/ox/sax.c +45 -7
- data/lib/ox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbb2d5fe1b036f9e4802ed6357cbe71472d3fbd0
|
4
|
+
data.tar.gz: 7732319c54eaa32c56a8f35a44032b99bc29a42c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b20bea5b1377b022d4ad864574cc8ed4c7b613f47e28722eba7ff1a438fd471068952a69a4e762df7a3d06a9f786fd6d38397e8fb3c36da4c75900b72c834b1e
|
7
|
+
data.tar.gz: 916f26854111928b6b402dcfbae0288b4c99b6544b31601ec7860b19a36e4160f53f2839b62598a196d426c9685f6b4a4ba9367b7f03654a0fd81963d86a4a35
|
data/README.md
CHANGED
@@ -34,13 +34,9 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
34
34
|
|
35
35
|
## <a name="release">Release Notes</a>
|
36
36
|
|
37
|
-
### Release 2.0.
|
37
|
+
### Release 2.0.7
|
38
38
|
|
39
|
-
- Fixed
|
40
|
-
|
41
|
-
- Limit depth on dump to 1000 to avoid core dump on circular references if the user does not specify circular.
|
42
|
-
|
43
|
-
- Handles dumping non-string values for attributes correctly by converting the value to a string.
|
39
|
+
- Fixed DOCTYPE parsing to handle nested '>' characters.
|
44
40
|
|
45
41
|
## <a name="description">Description</a>
|
46
42
|
|
data/ext/ox/parse.c
CHANGED
@@ -294,32 +294,60 @@ read_instruction(PInfo pi) {
|
|
294
294
|
attr_stack_cleanup(&attrs);
|
295
295
|
}
|
296
296
|
|
297
|
+
static void
|
298
|
+
read_delimited(PInfo pi, char end) {
|
299
|
+
char c;
|
300
|
+
|
301
|
+
if ('"' == end || '\'' == end) {
|
302
|
+
for (c = *pi->s++; end != c; c = *pi->s++) {
|
303
|
+
if ('\0' == c) {
|
304
|
+
set_error(&pi->err, "invalid format, dectype not terminated", pi->str, pi->s);
|
305
|
+
return;
|
306
|
+
}
|
307
|
+
}
|
308
|
+
} else {
|
309
|
+
while (1) {
|
310
|
+
c = *pi->s++;
|
311
|
+
if (end == c) {
|
312
|
+
return;
|
313
|
+
}
|
314
|
+
switch (c) {
|
315
|
+
case '\0':
|
316
|
+
set_error(&pi->err, "invalid format, dectype not terminated", pi->str, pi->s);
|
317
|
+
return;
|
318
|
+
case '"':
|
319
|
+
read_delimited(pi, c);
|
320
|
+
break;
|
321
|
+
case '\'':
|
322
|
+
read_delimited(pi, c);
|
323
|
+
break;
|
324
|
+
case '[':
|
325
|
+
read_delimited(pi, ']');
|
326
|
+
break;
|
327
|
+
case '<':
|
328
|
+
read_delimited(pi, '>');
|
329
|
+
break;
|
330
|
+
default:
|
331
|
+
break;
|
332
|
+
}
|
333
|
+
}
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
297
337
|
/* Entered after the "<!DOCTYPE" sequence plus the first character after
|
298
|
-
* that. Ready to read the rest.
|
338
|
+
* that. Ready to read the rest.
|
299
339
|
*/
|
300
340
|
static void
|
301
341
|
read_doctype(PInfo pi) {
|
302
342
|
char *docType;
|
303
|
-
int depth = 1;
|
304
|
-
char c;
|
305
343
|
|
306
344
|
next_non_white(pi);
|
307
345
|
docType = pi->s;
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
set_error(&pi->err, "invalid format, prolog not terminated", pi->str, pi->s);
|
312
|
-
return;
|
313
|
-
} else if ('<' == c) {
|
314
|
-
depth++;
|
315
|
-
} else if ('>' == c) {
|
316
|
-
depth--;
|
317
|
-
if (0 == depth) { /* done, at the end */
|
318
|
-
pi->s--;
|
319
|
-
break;
|
320
|
-
}
|
321
|
-
}
|
346
|
+
read_delimited(pi, '>');
|
347
|
+
if (err_has(&pi->err)) {
|
348
|
+
return;
|
322
349
|
}
|
350
|
+
pi->s--;
|
323
351
|
*pi->s = '\0';
|
324
352
|
pi->s++;
|
325
353
|
if (0 != pi->pcb->add_doctype) {
|
data/ext/ox/sax.c
CHANGED
@@ -483,23 +483,58 @@ read_instruction(SaxDrive dr) {
|
|
483
483
|
return c;
|
484
484
|
}
|
485
485
|
|
486
|
+
static char
|
487
|
+
read_delimited(SaxDrive dr, char end) {
|
488
|
+
char c;
|
489
|
+
|
490
|
+
if ('"' == end || '\'' == end) {
|
491
|
+
while (end != (c = buf_get(&dr->buf))) {
|
492
|
+
if ('\0' == c) {
|
493
|
+
ox_sax_drive_error(dr, NO_TERM "doctype not terminated");
|
494
|
+
return c;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
} else {
|
498
|
+
while (1) {
|
499
|
+
c = buf_get(&dr->buf);
|
500
|
+
if (end == c) {
|
501
|
+
return c;
|
502
|
+
}
|
503
|
+
switch (c) {
|
504
|
+
case '\0':
|
505
|
+
ox_sax_drive_error(dr, NO_TERM "doctype not terminated");
|
506
|
+
return c;
|
507
|
+
case '"':
|
508
|
+
c = read_delimited(dr, c);
|
509
|
+
break;
|
510
|
+
case '\'':
|
511
|
+
c = read_delimited(dr, c);
|
512
|
+
break;
|
513
|
+
case '[':
|
514
|
+
c = read_delimited(dr, ']');
|
515
|
+
break;
|
516
|
+
case '<':
|
517
|
+
c = read_delimited(dr, '>');
|
518
|
+
break;
|
519
|
+
default:
|
520
|
+
break;
|
521
|
+
}
|
522
|
+
}
|
523
|
+
}
|
524
|
+
return c;
|
525
|
+
}
|
526
|
+
|
486
527
|
/* Entered after the "<!DOCTYPE" sequence. Ready to read the rest.
|
487
528
|
*/
|
488
529
|
static char
|
489
530
|
read_doctype(SaxDrive dr) {
|
490
|
-
char c;
|
491
531
|
int line = dr->buf.line;
|
492
532
|
int col = dr->buf.col - 10;
|
493
533
|
char *s;
|
494
534
|
|
495
535
|
buf_backup(&dr->buf); /* back up to the start in case the cdata is empty */
|
496
536
|
buf_protect(&dr->buf);
|
497
|
-
|
498
|
-
if ('\0' == c) {
|
499
|
-
ox_sax_drive_error(dr, NO_TERM "doctype not terminated");
|
500
|
-
return c;
|
501
|
-
}
|
502
|
-
}
|
537
|
+
read_delimited(dr, '>');
|
503
538
|
if (dr->options.smart && 0 == dr->hints) {
|
504
539
|
for (s = dr->buf.str; is_white(*s); s++) { }
|
505
540
|
if (0 == strncasecmp("HTML", s, 4)) {
|
@@ -1226,6 +1261,8 @@ ox_sax_collapse_special(SaxDrive dr, char *str, int line, int col) {
|
|
1226
1261
|
b = ox_ucs_to_utf8_chars(b, u);
|
1227
1262
|
#endif
|
1228
1263
|
} else {
|
1264
|
+
b = ox_ucs_to_utf8_chars(b, u);
|
1265
|
+
/*
|
1229
1266
|
ox_sax_drive_error(dr, NO_TERM "Invalid encoding, need UTF-8 encoding to parse &#nnnn; character sequences.");
|
1230
1267
|
*b++ = '&';
|
1231
1268
|
*b++ = '#';
|
@@ -1233,6 +1270,7 @@ ox_sax_collapse_special(SaxDrive dr, char *str, int line, int col) {
|
|
1233
1270
|
*b++ = x;
|
1234
1271
|
}
|
1235
1272
|
continue;
|
1273
|
+
*/
|
1236
1274
|
}
|
1237
1275
|
s = end + 1;
|
1238
1276
|
continue;
|
data/lib/ox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "A fast XML parser and object serializer that uses only standard C lib.\n
|
14
14
|
\ \nOptimized XML (Ox), as the name implies was written to provide speed
|