[Theora-dev] Invalid read of size 1...

Mat heavensdoor78 at gmail.com
Fri Oct 28 06:42:49 PDT 2005


Mat wrote:

> I noticed some things:
> - if I encode images programmatically generated (like in the last app 
> I posted here in the ML...) my debugger says it's all ok (no errors)
> - if I grab a simple image ( I put a paper in front of the video 
> camera :) ) the Invalid read's message I reported above is fired 
> little times (sometimes also 0)
> - if I grab an image ( of the room ) the Invalid read's message I 
> reported above is fired many times ( variable )

[UPDATE]
Looking in the debugger output the buffer subject of the Invalid read' 
is in the file  pp.c  row  139:

 ppi->ChLocals =
   _ogg_malloc(ppi->ScanConfig.VideoFrameWidth*
               sizeof(*ppi->ChLocals) * CHLOCALS_CB_ROWS);

If I change this lines in:

 ppi->ChLocals =
   _ogg_malloc(ppi->ScanConfig.VideoFrameWidth*
               sizeof(*ppi->ChLocals) * CHLOCALS_CB_ROWS + 2);
memset( ppi->ChLocals, 0, 
ppi->ScanConfig.VideoFrameWidth*sizeof(*ppi->ChLocals) * 
CHLOCALS_CB_ROWS + 2 );
ppi->ChLocals++;

The debugger says it's all ok
(there's a small memory leak because of  ppi->ChLocals++ , free is 
trying to free the next byte, ignored for my test of course)

So it seems the problem is with this buffer, and not only a reading of 1 
byte before the beginning but also a readinf of 1 byte after the ending...
I tryed to allocate only 1 more byte for  ppi->ChLocals , with and 
without  ppi->ChLocals++  ( to get a boundary byte before and then a 
boundary byte after )

Hope it could help...



More information about the Theora-dev mailing list