[Ffmpeg-devel] [PATCH] read pnm header correctly on buffer boundary

Christian Linhart chris
Sun Jun 18 01:17:09 CEST 2006


Hi Michael,

Thanks for reviewing my patch.
I'll create a new patch which fixes it the correct way, so that 
pnm-headers of arbitrary length are supported.
(This may take a few days since that's a more complicated change and 
therefore needs more testing with a variety of test data.)

As to the AV_LOG_DEBUG --> AV_LOG_ERROR:

I was not sure about this because of the following code in pnm_parse which
appearently tries to skip until a valid header is found.
So maybe there is a well-defined reason for that which
would make it not an error condition but a warning or debug message.
What do you think?

-------------------------- (after pnm_decode_header fails) 
--------------------------
        if(pnmctx.bytestream < pnmctx.bytestream_end){
            if(pc->index){
                pc->index=0;
            }else{
                buf++;
                buf_size--;
            }
            goto retry;
        }
-----------------------------------------------------------------------------------------

Bye,
Chris


Michael Niedermayer wrote:

>Hi
>
>On Sun, Jun 18, 2006 at 12:05:27AM +0200, Christian Linhart wrote:
>  
>
>>[...]
>>
>>I fixed the bug by making sure that pnm_decode_header
>>gets at least 32 Bytes of real data.
>>    
>>
>
>this is not a solution, the header can be arbitrary long, containing
>whitespace, comments and other stuff ...
>pnm_decode_header() should check that the header isnt truncated 
>  
>

>
>[...]
>
>  
>
>>-    if(pnm_decode_header(avctx, s) < 0)
>>+    if(pnm_decode_header(avctx, s) < 0) {
>>+       av_log(avctx, AV_LOG_DEBUG, "ffmpeg: pnm_decode_frame: 
>>pnm_decode_header error.\n");
>>        return -1;
>>+    }
>>    
>>
>
>AV_LOG_DEBUG -> AV_LOG_ERROR
>  
>





More information about the ffmpeg-devel mailing list