[FFmpeg-devel] [PATCH]libavformat/http: fix http error eof

raymond zheng raymondzheng1412 at gmail.com
Thu Jun 1 09:27:19 EEST 2017


This patch is only for solving the bug introduced by chunksize has been
initial set as UINT64 MAX.

2017-05-27 19:24 GMT+08:00 Ronald S. Bultje <rsbultje at gmail.com>:

> Hi,
>
> On Fri, May 26, 2017 at 10:36 PM, raymond zheng <
> raymondzheng1412 at gmail.com> wrote:
>
>> Hi:
>>      I find an issue about http. I don't use chunked, so s->chunksize
>> will be set as UINT64_MAX when http open, but because of "if
>> (s->chunksize > 0) s->chunksize -= len;" then chunksize will not be
>> UINT64_MAX.
>>
>>     If ffurl_read return to 0, s->off < target_end, http_buf_read will
>> return to 0, then this will lead to eof, so this is incorrect, and
>> http_buf_read should return to AVERROR(EIO).
>>
>> the bug reproduce step:
>>
>> 1. An exception occurred in the  CDN edge server, that will lead to close
>> the http connection.
>>
>> 2. Because http is disconnected, so ffurl_read will return 0
>>
>> 3. Avformat will consider I/O is eof
>>
>> 4. Right now http is actually disconnect abnormally, it should return to
>> ERROR, rather than return to EOF.
>>
>>
>> this problem was caused by commit: 2a05c8f813de6f2278827734bf8102
>> 291e7484aa
>>
> What if the server legitimately responds that the chunksize is actually
> UINT64_MAX? I almost feel like these special values should be replaced by a
> new flag.
>
> Ronald
>


More information about the ffmpeg-devel mailing list