UIC/PICNIC JPEG-XR Crash - 7.0.6.060

UIC/PICNIC JPEG-XR Crash - 7.0.6.060

I have a relatively large image that I have compressed to JPEG-XR (with a quality factor of 50) using the PICNIC application. When I try to open the image with the PICNIC application it just displays a black screen. That is what happens with the stock binary PICNIC application (which appears to have built against Visual Studio 2010). I have a custom version of the PICNIC application (actually the JPEG and JPEG-XR codec dlls are custom) that I have built against Visual Studio 2008. When I attempt to open the image, picnic will crash with stack corruption errors (so it crashes in different places). The compressed image itself is fine (the Windows 7 image viewer will happily open it). The image that causes the problem is 8336x11872 at 8 BPP. If I scale the image to 95% of the original size (in both directions), both the stock and my custom PICNIC applications will open/decompress the image without issue. This scaled image is 7919x11278 at 8 BPP. Is there some known size limitation that I haven't seen?Thanks,Torin Ford

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I'm also seeing some JPEG-XR crashes in the picnic application. We'll look into this and get back to you.

Best regards,

Jeff

Best Reply

Good day.

There is a bug, memory allocator for predictor table uses wrong variable so it overfows when image size exceeds 8194 pixels in width (512 macroblocks, height doesn't matter).

There is a simple fix:

Replace m_iLumaSize with m_iMaxTileMBWidth in jpegxrmbdec.cpp, line 376:

  // Allocate general memory

  iAllocSize += sizeof(PredictorInf) * m_iMaxTileMBWidth * m_iChannels * m_iTileThreads * 2; // Predictor info

  iAllocSize += sizeof(QuantInf) * m_iChannels; // Quantizers Info DC

Replace m_pParent->m_iInMBSize with m_pParent->m_iMaxTileMBWidth in jpegxrmbdec.cpp, line 524:
  // Allocate Predictor Info

  pAllocPtr = m_pParent->m_pPredBuffer;

  pAllocPtr += (sizeof(PredictorInf) * m_pParent->m_iMaxTileMBWidth * m_iChannels * 2 * m_pParent->m_iInstances);

  initPredictor(&pAllocPtr, m_iChannels, m_pParent->m_iMaxTileMBWidth, m_pPred, m_pPredPrev);

Pavel, Thanks for the fix. That does appear to solve the immediate issue at hand. I did however notice that if you try to open 1 large (e.g. dirmensioned as in original post) image of any type (tested with TIF and JPEG-XR), then try to open another one of similar size you eventually start getting "QImage: out of memory, returning null" errors displayed in the console that you started picnic from and of course the image does not open. But that appears to be a separate issue and should probably be listed in a new forum thread.Thanks again for the fix.Torin Ford

Leave a Comment

Please sign in to add a comment. Not a member? Join today