Skip to content

Commit c164394

Browse files
samyronbyroot
authored andcommitted
[ruby/json] fix issue reading off the end of the ByteBuffer if ptr > 0
Fix: ruby/json#859 ruby/json@67ebabec75 Co-Authored-By: Jean Boussier <[email protected]>
1 parent 5c59fb5 commit c164394

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/json/json_encoding_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ def test_generate
3131
assert_equal @generated, JSON.generate(@utf_16_data, ascii_only: true)
3232
end
3333

34+
def test_generate_shared_string
35+
# Ref: https://github.com/ruby/json/issues/859
36+
s = "01234567890"
37+
assert_equal '"234567890"', JSON.dump(s[2..-1])
38+
end
39+
3440
def test_unicode
3541
assert_equal '""', ''.to_json
3642
assert_equal '"\\b"', "\b".to_json

0 commit comments

Comments
 (0)