Hi,

Le 08/11/2018 à 20:50, Michael Niedermayer a écrit :
>> +    line = av_malloc(line_size);
>> +    if (!line)
>> +        return AVERROR(ENOMEM);
> 
> this would use alot of memory for large files, also avio_size() will not
> work with all inputs

Yes I thought so as well, that was a quick fix for a friend in need.

> using av_fast_realloc() or similar should avoid both issues

You mean, having get_line() reallocate 1kB more each time it runs out
without finding a \n?

Btw, I noticed there was an avio_get_line() which was quite similar,
maybe those could be merged?


> 
>>  
>>      while(!avio_feof(s->pb)) {
>> -        get_line(s->pb, line, sizeof(line));
>> +        get_line(s->pb, line, line_size);
>>  
> 
>>          if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
> 
> out of memory access can happen here

Right. Preallocating at least 1kB would fix it though.


François.

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to