On May 26, 2014, at 6:02 AM, Pax <45rpmli...@googlemail.com> wrote: > When this gets run, I get EXC_BAD_ACCESS code = 2 here. I'm demonstrably > reading less data than the file contains, and I've been able to read through > the file successfully up to this point. Please could someone suggest to me > what might be going wrong here?
Use the debugger to look at the values of the relevant variables, especially dataSize. Since the result is a crash instead of an exception, the NSRange you create is valid; so I assume it’s just larger than your buffer so the copy runs off the end into unmapped address space. Also, what exactly is the type of ‘bytes’? If it’s a pointer to a malloced buffer, you shouldn’t be passing its address, rather its value, otherwise you’re going to copy into the stack and blow up. —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com