Skip to content

Commit

Permalink
Fix adding long strings to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Mar 10, 2022
1 parent ec78820 commit ca980cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All changes to the Ox gem are documented here. Releases follow semantic versioning.

## [2.14.10] - 2022-03-10

### Fixed

- Writing strings over 16K to a file with builder no longer causes a crash.

## [2.14.9] - 2022-02-11

### Fixed
Expand Down
8 changes: 8 additions & 0 deletions ext/ox/buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,16 @@ buf_append_string(Buf buf, const char *s, size_t slen) {

if (len != (size_t)write(buf->fd, buf->head, len)) {
buf->err = true;
return;
}
buf->tail = buf->head;
if (sizeof(buf->base) <= slen) {
if (slen != (size_t)write(buf->fd, s, slen)) {
buf->err = true;
return;
}
return;
}
} else {
size_t len = buf->end - buf->head;
size_t toff = buf->tail - buf->head;
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.14.9'
VERSION = '2.14.10'
end

0 comments on commit ca980cd

Please sign in to comment.