CC-Archived / CCMultipartReader

An Objective C wrapper for multipart-parser, Hongli Lai's C++ implementation of a simple and efficient multipart MIME message parser.
MIT License
7 stars 1 forks source link

crash on ios-devices, in simulator all seems to be fine #1

Open flandy84 opened 12 years ago

flandy84 commented 12 years ago

Hi,

thanks again for that great wrapper. Aself-explanatory Obj-C API as well.

I 've got a small problem. On Simulator the parser works well, but on a device it crashes all the time in my tests. I feed the parser with this multipart-File https://dl.dropbox.com/u/12083655/delta-product-images-07-06-2012.bsr and the crash (EXC_BAD_ACCESS code=1) occurs on the codeline MultipartParser:138 (c = buffer[i]).

Any Idea what is the problem here? Can you reproduce it?

johnyanarella commented 12 years ago

Just saw this tonight - are you still seeing this issue (or were you able to resolve it since you reported it)?

flandy84 commented 12 years ago

Yes, it's still an issue. This "array-out-of-bounds"-crash depends on the buffer-size of the data-chunks i feed the parser with. (depending on current network-connection type on the device the network-packages delivered varies in size. i download the file per http-request). with the combination of chunk-buffer-size of 16384 bytes and my posted Multipart-File, the parser crashes reproducible already on first data-chunk. with this check (c = (i<len)?buffer[i]:0;) i worked-around this crash, but don't know if this modification leads to other side-effects. Also don't know if there are other out-of-bounds issues with other file/chunk combinations in other parser-code-fragments