[MacRuby-devel] [MacRuby] #577: EXC_BAD_ACCESS in IO.read
MacRuby
ruby-noreply at macosforge.org
Tue Jan 26 15:57:11 PST 2010
#577: EXC_BAD_ACCESS in IO.read
---------------------------------+------------------------------------------
Reporter: spamtrap1@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: minor | Milestone:
Component: MacRuby | Keywords:
---------------------------------+------------------------------------------
I had a small spelling accident tonight, which caused me to stumble over
this :[[BR]]
using ios.read, with an argument of nil, i.e.
{{{
s = ""
f = File.open("xxx")
while (!f.eof?)
s += f.read(nil)
end
}}}
will cause this :
{{{
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
objc[26488]: garbage collection is ON
0 libSystem.B.dylib 0x00007fffffe007c5 __memcpy + 37
1 libauto.dylib 0x00007fff83a1f210
auto_zone_write_barrier_memmove + 96
2 libauto.dylib 0x00007fff83a2020e
auto_realloc(_malloc_zone_t*, void*, unsigned long) + 878
3 libSystem.B.dylib 0x00007fff84c1ab3b
malloc_zone_realloc + 92
4 com.apple.CoreFoundation 0x00007fff8215eb49 __CFDataGrow +
233
5 com.apple.CoreFoundation 0x00007fff82184e05 CFDataSetLength
+ 181
6 libmacruby.dylib 0x000000010005c1fa
rb_io_read_internal + 522
7 libmacruby.dylib 0x000000010005d6b6 rb_io_eof + 54
8 libmacruby.dylib 0x000000010016d32f rb_vm_dispatch
+ 7279
}}}
Macruby version is Nightly build from 2010/01/26.
The weird thing is i can only reproduce it with large files. My test files
are CD sized, created with "dd if=/dev/random of=test.dat bs=65536
count=10000"
I know calling read(nil) twice on a file doesn't make much sense, but
reading the docs leads me to believe it should just return "" (http
://ruby-doc.org/core/classes/IO.html)
--
Ticket URL: <http://www.macruby.org/trac/ticket/577>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list