Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for v2.8.1 #3

Open
wants to merge 1 commit into
base: origin-v2.8.1-1733713639
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

## 2.8.2 - October 30, 2017

- Fixed bug with SAX parser that caused a crash with very long invalid instruction element.

## 2.8.1 - October 27, 2017

- Avoid crash with invalid XML passed to Oj.parse_obj().
Expand Down
6 changes: 3 additions & 3 deletions ext/ox/sax.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ static char
read_instruction(SaxDrive dr) {
char content[1024];
char c;
char *cend;
int coff;
VALUE target = Qnil;
int is_xml;
int pos = dr->buf.pos - 1;
Expand Down Expand Up @@ -510,7 +510,7 @@ read_instruction(SaxDrive dr) {
line = dr->buf.line;
col = dr->buf.col;
read_content(dr, content, sizeof(content) - 1);
cend = dr->buf.tail;
coff = dr->buf.tail - dr->buf.head;
buf_reset(&dr->buf);
dr->err = 0;
c = read_attrs(dr, c, '?', '?', is_xml, 1, NULL);
Expand Down Expand Up @@ -545,7 +545,7 @@ read_instruction(SaxDrive dr) {
}
rb_funcall2(dr->handler, ox_text_id, 1, args);
}
dr->buf.tail = cend;
dr->buf.tail = dr->buf.head + coff;
c = buf_get(&dr->buf);
} else {
pos = dr->buf.pos;
Expand Down
2 changes: 1 addition & 1 deletion ext/ox/sax_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int
ox_sax_buf_read(Buf buf) {
int err;
size_t shift = 0;

// if there is not much room to read into, shift or realloc a larger buffer.
if (buf->head < buf->tail && 4096 > buf->end - buf->tail) {
if (0 == buf->pro) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ox/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

module Ox
# Current version of the module.
VERSION = '2.8.1'
VERSION = '2.8.2'
end