Skip to content

Commit df90a64

Browse files
authored
ZJIT: Use Marshal.dump to handle large writes
`File.binwrite` with a big string can exceed the `INT_MAX` limit of write(2) and fail with an exception.
1 parent 56f777c commit df90a64

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

zjit.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ def dump_exit_locations(filename)
126126
raise ArgumentError, "--zjit-trace-exits must be enabled to use dump_exit_locations."
127127
end
128128

129-
File.binwrite(filename, Marshal.dump(RubyVM::ZJIT.exit_locations))
129+
File.open(filename, "wb") do |file|
130+
Marshal.dump(RubyVM::ZJIT.exit_locations, file)
131+
end
130132
end
131133

132134
# Check if `--zjit-stats` is used

0 commit comments

Comments
 (0)