Commit 6d33e91
authored
Fix memory corruption with FFI backend (#180)
To reproduce with JRuby or TruffleRuby:
```ruby
require "fiddle"
1000.times do
Fiddle::Pointer[rand(255).chr*16]
end
```
`put_string` adds a null byte at the end vs `write_bytes`. This is not
caught by the bounds check since the underlying `FFI::Pointer` size is
not set.1 parent 582f443 commit 6d33e91
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| |||
0 commit comments