<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I've got a piece of code which extracts every rgb pixel from a video
    and displays it without any problem. But when I ran it with Purify,
    I got these errors:<br>
    <b><br>
      [E] ABR: Array bounds read in GetFrame {197 occurrences}<br>
              Reading 1 byte from 0x04ae0040 (1 byte at 0x04ae0040
      illegal)<br>
              Address 0x04ae0040 is 16 bytes before the beginning of a
      1769472 byte block at 0x04ae0050<br>
              Address 0x04ae0040 points to a malloc'd block in heap
      0x003a0000<br>
              Thread ID: 0x17c4</b><br>
    <br>
    So I reduced the code to just this<br>
    <b>pAreaInMemory[0] = g_pFrameRGB->data[0][0];</b><br>
    and I'm still getting the error (which I've shown above).  <br>
    The code goes something like this (I've shown many of the
    initializations in GetFrame itself although they're supposed to be
    outside):<br>
    <br>
    bool GetFrame()<br>
    {<br>
       ...blah...<br>
       AVFrame*  g_pFrameRGB = NULL;<br>
       avpicture_fill_proc((AVPicture *) g_pFrameRGB, pbuffer,
    PIX_FMT_RGB24, g_metadata->WIDTH, g_metadata->HEIGHT);<br>
       ...blah...<br>
       sws_scale_proc(g_sws_ctx, (uint8_t const * const
    *)g_pFrame->data, g_pFrame->linesize, 0,
    g_metadata->HEIGHT, g_pFrameRGB->data,
    g_pFrameRGB->linesize );<br>
       ...blah...<br>
       unsigned char* pAreaInMemory = (unsigned char*) malloc(
    sizeof(unsigned char) * 1024 * 768 );<br>
       ...get the video data here...<br>
       pAreaInMemory[0] = g_pFrameRGB->data[0][0];   <br>
       ...blah...<br>
       free(pAreaInMemory);<br>
    }<br>
    <br>
    Why is there a bounds problem when reading from data[0][0] ? I
    noticed the way data is initialized in ffmpeg. Is this purify error
    something I can ignore (there's no memory leak. Just the bounds
    error) or can it lead to serious problems? <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Navin</pre>
  </body>
</html>