ox 2.8.1 → 2.8.2
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/ox.c +18 -18
- data/ext/ox/sax.c +7 -6
- data/ext/ox/sax_buf.c +1 -1
- 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: 066b29e775aa1fbf8beb40e572299a3b99155c92
|
4
|
+
data.tar.gz: 41c0e36f4f7bbebcef8f27c7e75d80c3c6420423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbdf712b54810a1bff6c211d0f4b7e63ee8a1ed48911b4d43491c3792acd44c3f32bdc6da7028f8de87dfcc937162bb8116e13c9d73c1a60998a7eafb71efa24
|
7
|
+
data.tar.gz: f7378812079495da8752277b52c7372e739b848e24cf1845eb6e1d48e625d560c93374373d7d429b2612111b2173a9ce180a32385734e3b2f8e073f0937b143a
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
|
2
|
+
## 2.8.2 - November 1, 2017
|
3
|
+
|
4
|
+
- Fixed bug with SAX parser that caused a crash with very long invalid instruction element.
|
5
|
+
|
6
|
+
- Fixed SAX parse error with double <source> elements.
|
7
|
+
|
2
8
|
## 2.8.1 - October 27, 2017
|
3
9
|
|
4
10
|
- Avoid crash with invalid XML passed to Oj.parse_obj().
|
data/ext/ox/ox.c
CHANGED
@@ -537,8 +537,8 @@ set_def_opts(VALUE self, VALUE opts) {
|
|
537
537
|
Check_Type(v, T_STRING);
|
538
538
|
slen = RSTRING_LEN(v);
|
539
539
|
if (sizeof(ox_default_options.inv_repl) - 2 < (size_t)slen) {
|
540
|
-
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %
|
541
|
-
sizeof(ox_default_options.inv_repl) - 2);
|
540
|
+
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %d characters.",
|
541
|
+
(int)sizeof(ox_default_options.inv_repl) - 2);
|
542
542
|
}
|
543
543
|
strncpy(ox_default_options.inv_repl + 1, StringValuePtr(v), sizeof(ox_default_options.inv_repl) - 1);
|
544
544
|
ox_default_options.inv_repl[sizeof(ox_default_options.inv_repl) - 1] = '\0';
|
@@ -558,8 +558,8 @@ set_def_opts(VALUE self, VALUE opts) {
|
|
558
558
|
Check_Type(v, T_STRING);
|
559
559
|
slen = RSTRING_LEN(v);
|
560
560
|
if (sizeof(ox_default_options.strip_ns) - 1 < (size_t)slen) {
|
561
|
-
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %
|
562
|
-
sizeof(ox_default_options.strip_ns) - 1);
|
561
|
+
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %d characters.",
|
562
|
+
(int)sizeof(ox_default_options.strip_ns) - 1);
|
563
563
|
}
|
564
564
|
strncpy(ox_default_options.strip_ns, StringValuePtr(v), sizeof(ox_default_options.strip_ns) - 1);
|
565
565
|
ox_default_options.strip_ns[sizeof(ox_default_options.strip_ns) - 1] = '\0';
|
@@ -572,8 +572,8 @@ set_def_opts(VALUE self, VALUE opts) {
|
|
572
572
|
Check_Type(v, T_STRING);
|
573
573
|
slen = RSTRING_LEN(v);
|
574
574
|
if (sizeof(ox_default_options.margin) - 1 < (size_t)slen) {
|
575
|
-
rb_raise(ox_parse_error_class, ":margin can be no longer than %
|
576
|
-
sizeof(ox_default_options.margin) - 1);
|
575
|
+
rb_raise(ox_parse_error_class, ":margin can be no longer than %d characters.",
|
576
|
+
(int)sizeof(ox_default_options.margin) - 1);
|
577
577
|
}
|
578
578
|
strncpy(ox_default_options.margin, StringValuePtr(v), sizeof(ox_default_options.margin) - 1);
|
579
579
|
ox_default_options.margin[sizeof(ox_default_options.margin) - 1] = '\0';
|
@@ -769,8 +769,8 @@ load(char *xml, int argc, VALUE *argv, VALUE self, VALUE encoding, Err err) {
|
|
769
769
|
Check_Type(v, T_STRING);
|
770
770
|
slen = RSTRING_LEN(v);
|
771
771
|
if (sizeof(options.inv_repl) - 2 < (size_t)slen) {
|
772
|
-
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %
|
773
|
-
sizeof(options.inv_repl) - 2);
|
772
|
+
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %d characters.",
|
773
|
+
(int)sizeof(options.inv_repl) - 2);
|
774
774
|
}
|
775
775
|
strncpy(options.inv_repl + 1, StringValuePtr(v), sizeof(options.inv_repl) - 1);
|
776
776
|
options.inv_repl[sizeof(options.inv_repl) - 1] = '\0';
|
@@ -789,8 +789,8 @@ load(char *xml, int argc, VALUE *argv, VALUE self, VALUE encoding, Err err) {
|
|
789
789
|
Check_Type(v, T_STRING);
|
790
790
|
slen = RSTRING_LEN(v);
|
791
791
|
if (sizeof(options.strip_ns) - 1 < (size_t)slen) {
|
792
|
-
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %
|
793
|
-
sizeof(options.strip_ns) - 1);
|
792
|
+
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %d characters.",
|
793
|
+
(int)sizeof(options.strip_ns) - 1);
|
794
794
|
}
|
795
795
|
strncpy(options.strip_ns, StringValuePtr(v), sizeof(options.strip_ns) - 1);
|
796
796
|
options.strip_ns[sizeof(options.strip_ns) - 1] = '\0';
|
@@ -802,8 +802,8 @@ load(char *xml, int argc, VALUE *argv, VALUE self, VALUE encoding, Err err) {
|
|
802
802
|
Check_Type(v, T_STRING);
|
803
803
|
slen = RSTRING_LEN(v);
|
804
804
|
if (sizeof(options.margin) - 1 < (size_t)slen) {
|
805
|
-
rb_raise(ox_parse_error_class, ":margin can be no longer than %
|
806
|
-
sizeof(options.margin) - 1);
|
805
|
+
rb_raise(ox_parse_error_class, ":margin can be no longer than %d characters.",
|
806
|
+
(int)sizeof(options.margin) - 1);
|
807
807
|
}
|
808
808
|
strncpy(options.margin, StringValuePtr(v), sizeof(options.margin) - 1);
|
809
809
|
options.margin[sizeof(options.margin) - 1] = '\0';
|
@@ -1055,8 +1055,8 @@ sax_parse(int argc, VALUE *argv, VALUE self) {
|
|
1055
1055
|
Check_Type(v, T_STRING);
|
1056
1056
|
slen = RSTRING_LEN(v);
|
1057
1057
|
if (sizeof(options.strip_ns) - 1 < (size_t)slen) {
|
1058
|
-
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %
|
1059
|
-
sizeof(options.strip_ns) - 1);
|
1058
|
+
rb_raise(ox_parse_error_class, ":strip_namespace can be no longer than %d characters.",
|
1059
|
+
(int)sizeof(options.strip_ns) - 1);
|
1060
1060
|
}
|
1061
1061
|
strncpy(options.strip_ns, StringValuePtr(v), sizeof(options.strip_ns) - 1);
|
1062
1062
|
options.strip_ns[sizeof(options.strip_ns) - 1] = '\0';
|
@@ -1209,8 +1209,8 @@ parse_dump_options(VALUE ropts, Options copts) {
|
|
1209
1209
|
Check_Type(v, T_STRING);
|
1210
1210
|
slen = RSTRING_LEN(v);
|
1211
1211
|
if (sizeof(copts->inv_repl) - 2 < (size_t)slen) {
|
1212
|
-
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %
|
1213
|
-
sizeof(copts->inv_repl) - 2);
|
1212
|
+
rb_raise(ox_parse_error_class, ":invalid_replace can be no longer than %d characters.",
|
1213
|
+
(int)sizeof(copts->inv_repl) - 2);
|
1214
1214
|
}
|
1215
1215
|
strncpy(copts->inv_repl + 1, StringValuePtr(v), sizeof(copts->inv_repl) - 1);
|
1216
1216
|
copts->inv_repl[sizeof(copts->inv_repl) - 1] = '\0';
|
@@ -1224,8 +1224,8 @@ parse_dump_options(VALUE ropts, Options copts) {
|
|
1224
1224
|
Check_Type(v, T_STRING);
|
1225
1225
|
slen = RSTRING_LEN(v);
|
1226
1226
|
if (sizeof(copts->margin) - 2 < (size_t)slen) {
|
1227
|
-
rb_raise(ox_parse_error_class, ":margin can be no longer than %
|
1228
|
-
sizeof(copts->margin) - 2);
|
1227
|
+
rb_raise(ox_parse_error_class, ":margin can be no longer than %d characters.",
|
1228
|
+
(int)sizeof(copts->margin) - 2);
|
1229
1229
|
}
|
1230
1230
|
strncpy(copts->margin, StringValuePtr(v), sizeof(copts->margin) - 1);
|
1231
1231
|
copts->margin[sizeof(copts->margin) - 1] = '\0';
|
data/ext/ox/sax.c
CHANGED
@@ -448,7 +448,8 @@ read_content(SaxDrive dr, char *content, size_t len) {
|
|
448
448
|
char *end = content + len;
|
449
449
|
|
450
450
|
while ('\0' != (c = buf_get(&dr->buf))) {
|
451
|
-
if (end
|
451
|
+
if (end <= content) {
|
452
|
+
*content = '\0';
|
452
453
|
ox_sax_drive_error(dr, "processing instruction content too large");
|
453
454
|
return;
|
454
455
|
}
|
@@ -473,9 +474,9 @@ read_content(SaxDrive dr, char *content, size_t len) {
|
|
473
474
|
*/
|
474
475
|
static char
|
475
476
|
read_instruction(SaxDrive dr) {
|
476
|
-
char content[
|
477
|
+
char content[4096];
|
477
478
|
char c;
|
478
|
-
|
479
|
+
int coff;
|
479
480
|
VALUE target = Qnil;
|
480
481
|
int is_xml;
|
481
482
|
int pos = dr->buf.pos - 1;
|
@@ -510,7 +511,7 @@ read_instruction(SaxDrive dr) {
|
|
510
511
|
line = dr->buf.line;
|
511
512
|
col = dr->buf.col;
|
512
513
|
read_content(dr, content, sizeof(content) - 1);
|
513
|
-
|
514
|
+
coff = dr->buf.tail - dr->buf.head;
|
514
515
|
buf_reset(&dr->buf);
|
515
516
|
dr->err = 0;
|
516
517
|
c = read_attrs(dr, c, '?', '?', is_xml, 1, NULL);
|
@@ -545,7 +546,7 @@ read_instruction(SaxDrive dr) {
|
|
545
546
|
}
|
546
547
|
rb_funcall2(dr->handler, ox_text_id, 1, args);
|
547
548
|
}
|
548
|
-
dr->buf.tail =
|
549
|
+
dr->buf.tail = dr->buf.head + coff;
|
549
550
|
c = buf_get(&dr->buf);
|
550
551
|
} else {
|
551
552
|
pos = dr->buf.pos;
|
@@ -925,7 +926,7 @@ read_element_start(SaxDrive dr) {
|
|
925
926
|
end_element_cb(dr, top_nv->val, pos, line, col, top_nv->hint);
|
926
927
|
top_nv = stack_peek(&dr->stack);
|
927
928
|
}
|
928
|
-
if (0 != h->parents && NestOverlay != h->overlay) {
|
929
|
+
if (NULL != top_nv && 0 != h->parents && NestOverlay != h->overlay) {
|
929
930
|
const char **p;
|
930
931
|
int ok = 0;
|
931
932
|
|
data/ext/ox/sax_buf.c
CHANGED
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.8.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-01 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
|