Skip to content

Commit 231f53f

Browse files
committed
Fix position after reading null terminated string.
1 parent 6df3fd3 commit 231f53f

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Bug fixes:
1313
* Fix `String#[Regexp, Integer]` when the capture group exists but is not matched (@eregon).
1414
* Fix `File.open` mode string parsing when binary option is the third character (@bjfish).
1515
* Fix `rb_scan_args_kw` macro to avoid shadowing variables (#2649, @aardvark179).
16+
* Fix `String#unpack("Z")` to not advance after the null byte, like CRuby (#2659, @aardvark179).
1617

1718
Compatibility:
1819

src/main/java/org/truffleruby/core/format/read/bytes/ReadBinaryStringNode.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ protected RubyString read(VirtualFrame frame, byte[] source,
8181
while (start + length < getSourceLength(frame) && length < count && source[start + length] != 0) {
8282
length++;
8383
}
84-
85-
if (start + length < getSourceLength(frame) && source[start + length] == 0) {
86-
length++;
87-
}
8884
} else {
8985
length = count;
9086

0 commit comments

Comments
 (0)