<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Actually I'm giving avipicture_fill a value. I didn't show that bit
    of the code.<br>
    <i>g_pFrameRGB = avcodec_alloc_frame_proc();</i><br>
    <br>
    But it's strange that purify is showing an error while reading from
    data[0][0]. At least the first value should've been read correctly.
    Am a bit worried about this, since bounds errors would give problems
    at completely unexpected times.<br>
    Could anyone help with this? Perhaps you'd get the same error if you
    try even a simple ffmpeg program with Purify.<br>
    <pre class="moz-signature" cols="72">Navin
</pre>
    On 12/18/2012 2:57 PM, Alex Cohn wrote:
    <blockquote
cite="mid:CADiKgogpGDGKgqg6=xJfRBvO=yoXTbyaaTC2C0t2spwh2VFeDA@mail.gmail.com"
      type="cite">
      <blockquote type="cite">
        <pre wrap="">So I reduced the code to just this
pAreaInMemory[0] = g_pFrameRGB->data[0][0];
and I'm still getting the error (which I've shown above).
The code goes something like this (I've shown many of the initializations in
GetFrame itself although they're supposed to be outside):

bool GetFrame()
{
   ...blah...
   AVFrame*  g_pFrameRGB = NULL;
   avpicture_fill_proc((AVPicture *) g_pFrameRGB, pbuffer, PIX_FMT_RGB24,
g_metadata->WIDTH, g_metadata->HEIGHT);
</pre>
      </blockquote>
      <pre wrap="">
avipicture_fill does not expect NULL pointer to AVPicture as first
parameter. The pointer must be initialized (see doc/examples/muxing.c
for the correct usage).

BR,
Alex
_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>

</pre>
    </blockquote>
    <br>
    <br>
    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>
    <br>
  </body>
</html>