ox 2.14.25 → 2.14.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/ext/ox/parse.c +26 -4
- data/ext/ox/sax.c +5 -1
- data/ext/ox/sax_buf.c +2 -2
- data/lib/ox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '028d3be16e23f546d40a021dc76fe2a9a506f9f140f673e9e2aef60ab481fb5b'
|
|
4
|
+
data.tar.gz: 98efdca44712e1095cfaea485f66b46918649261fc0855794a6bf943d1a86e37
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1158647c428da2193d3de8c8a564077dc3e7854890dd9b31d79747e65dc14595a381ab079aaa3b9471d2b0de30d96c4b8698d1b82e2e53d34bfa6ff116a35cd
|
|
7
|
+
data.tar.gz: 43fcda76ed7d4d5febf5dc67e228278af4b16fcff4ff221ef4a3b39dbf0451d1da3f2ff25524079026ed482d14f0ae3d74af2019cb88f5296e6ebc340e4091b7
|
data/CHANGELOG.md
CHANGED
data/ext/ox/parse.c
CHANGED
|
@@ -302,6 +302,11 @@ DONE:
|
|
|
302
302
|
}
|
|
303
303
|
end = pi->s;
|
|
304
304
|
next_non_white(pi);
|
|
305
|
+
if ('\0' == *pi->s) {
|
|
306
|
+
attr_stack_cleanup(&attrs);
|
|
307
|
+
set_error(&pi->err, "invalid format, processing instruction not terminated", pi->str, pi->s);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
305
310
|
if ('=' != *pi->s++) {
|
|
306
311
|
attrs_ok = false;
|
|
307
312
|
break;
|
|
@@ -364,7 +369,8 @@ static void read_delimited(PInfo pi, char end) {
|
|
|
364
369
|
if ('"' == end || '\'' == end) {
|
|
365
370
|
for (c = *pi->s++; end != c; c = *pi->s++) {
|
|
366
371
|
if ('\0' == c) {
|
|
367
|
-
|
|
372
|
+
pi->s--;
|
|
373
|
+
set_error(&pi->err, "invalid format, doctype not terminated", pi->str, pi->s);
|
|
368
374
|
return;
|
|
369
375
|
}
|
|
370
376
|
}
|
|
@@ -375,7 +381,10 @@ static void read_delimited(PInfo pi, char end) {
|
|
|
375
381
|
return;
|
|
376
382
|
}
|
|
377
383
|
switch (c) {
|
|
378
|
-
case '\0':
|
|
384
|
+
case '\0':
|
|
385
|
+
pi->s--;
|
|
386
|
+
set_error(&pi->err, "invalid format, doctype not terminated", pi->str, pi->s);
|
|
387
|
+
return;
|
|
379
388
|
case '"': read_delimited(pi, c); break;
|
|
380
389
|
case '\'': read_delimited(pi, c); break;
|
|
381
390
|
case '[': read_delimited(pi, ']'); break;
|
|
@@ -535,6 +544,7 @@ static char *read_element(PInfo pi) {
|
|
|
535
544
|
break;
|
|
536
545
|
} else {
|
|
537
546
|
attr_stack_cleanup(&attrs);
|
|
547
|
+
pi->s--;
|
|
538
548
|
set_error(&pi->err, "invalid format, no attribute value", pi->str, pi->s);
|
|
539
549
|
return 0;
|
|
540
550
|
}
|
|
@@ -579,7 +589,7 @@ static char *read_element(PInfo pi) {
|
|
|
579
589
|
c = *pi->s++;
|
|
580
590
|
if ('\0' == c) {
|
|
581
591
|
attr_stack_cleanup(&attrs);
|
|
582
|
-
set_error(&pi->err, "invalid format, document not terminated", pi->str, pi->s);
|
|
592
|
+
set_error(&pi->err, "invalid format, document not terminated", pi->str, pi->s - 1);
|
|
583
593
|
return 0;
|
|
584
594
|
}
|
|
585
595
|
if ('<' == c) {
|
|
@@ -701,6 +711,11 @@ static char *read_element(PInfo pi) {
|
|
|
701
711
|
read_text(pi);
|
|
702
712
|
/*read_reduced_text(pi); */
|
|
703
713
|
|
|
714
|
+
if (err_has(&pi->err)) {
|
|
715
|
+
attr_stack_cleanup(&attrs);
|
|
716
|
+
return 0;
|
|
717
|
+
}
|
|
718
|
+
|
|
704
719
|
/* to exit read_text with no errors the next character must be < */
|
|
705
720
|
if ('/' == *(pi->s + 1) &&
|
|
706
721
|
0 == ((TolerantEffort == pi->options->effort) ? strncasecmp(ename, pi->s + 2, elen)
|
|
@@ -734,7 +749,10 @@ static void read_text(PInfo pi) {
|
|
|
734
749
|
done = 1;
|
|
735
750
|
pi->s--;
|
|
736
751
|
break;
|
|
737
|
-
case '\0':
|
|
752
|
+
case '\0':
|
|
753
|
+
pi->s--;
|
|
754
|
+
set_error(&pi->err, "invalid format, document not terminated", pi->str, pi->s);
|
|
755
|
+
return;
|
|
738
756
|
default:
|
|
739
757
|
if (end <= (b + (('&' == c) ? 7 : 0))) { /* extra 8 for special just in case it is sequence of bytes */
|
|
740
758
|
unsigned long size;
|
|
@@ -1027,6 +1045,10 @@ static char *read_coded_chars(PInfo pi, char *text) {
|
|
|
1027
1045
|
|
|
1028
1046
|
for (b = buf, s = pi->s; b < end; b++, s++) {
|
|
1029
1047
|
*b = *s;
|
|
1048
|
+
if ('\0' == *s) {
|
|
1049
|
+
set_error(&pi->err, "Not terminated coded char.", pi->str, pi->s);
|
|
1050
|
+
return NULL;
|
|
1051
|
+
}
|
|
1030
1052
|
if (';' == *s) {
|
|
1031
1053
|
*(b + 1) = '\0';
|
|
1032
1054
|
blen = b - buf;
|
data/ext/ox/sax.c
CHANGED
|
@@ -1496,7 +1496,11 @@ int ox_sax_collapse_special(SaxDrive dr, char *str, long pos, long line, long co
|
|
|
1496
1496
|
c = '&';
|
|
1497
1497
|
} else {
|
|
1498
1498
|
b = bn;
|
|
1499
|
-
|
|
1499
|
+
if ('\0' != *s2) {
|
|
1500
|
+
s = s2 + 1;
|
|
1501
|
+
} else {
|
|
1502
|
+
s = s2;
|
|
1503
|
+
}
|
|
1500
1504
|
continue;
|
|
1501
1505
|
}
|
|
1502
1506
|
}
|
data/ext/ox/sax_buf.c
CHANGED
|
@@ -69,8 +69,8 @@ void ox_sax_buf_init(Buf buf, VALUE io) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
int ox_sax_buf_read(Buf buf) {
|
|
72
|
-
int
|
|
73
|
-
|
|
72
|
+
int err;
|
|
73
|
+
long shift = 0;
|
|
74
74
|
|
|
75
75
|
// if there is not much room to read into, shift or realloc a larger buffer.
|
|
76
76
|
if (buf->head < buf->tail && 4096 > buf->end - buf->tail) {
|
data/lib/ox/version.rb
CHANGED