OpenSlideError: 00000000: expected a marker instead of

Benjamin Gilbert bgilbert at cs.cmu.edu
Mon Jan 7 23:54:29 EST 2013


On 01/07/2013 04:05 AM, Mathieu Malaterre wrote:
> $ ./aperio-bad-jp2k-tiles /tmp/266981.svs
> Directory: 0
>    Reading: 21691/21692
> Directory: 2
>    Reading: 1362/1363
> Directory: 3
>    Reading: 95/96

Toby: thanks for sending the slide file.

The tiles in the right-most column of your slide are all zero bytes 
long, except in level 0.  I'm guessing this is a bug in the program that 
wrote your file.

OpenSlide has no special handling for zero-length tiles, so we end up 
calling opj_cio_open() with a NULL buffer and 0 size.  This causes 
opj_cio_open() to think we want to *write* an image, so it allocates an 
output buffer.  We treat this as an input buffer and try to decompress 
its contents, which are random memory garbage.

The test program didn't catch this because it gets its buffer from 
malloc() instead of g_slice_alloc().  g_slice_alloc(0) == NULL but 
malloc(0) != NULL.

Fix:

     https://github.com/openslide/openslide/commit/d2fde27b

--Benjamin Gilbert



More information about the openslide-users mailing list