avformat/http: return EIO if s->hd is NULL

This could conceivably happen currently if the user tries reading more
bytes after the last chunk has already been received. In this case,
we currently segfault - but simply returning AVERROR(EIO) seems more
reasonable and lets the higher end retry the connection in this case.
This commit is contained in:
Niklas Haas
2026-01-23 11:16:16 +01:00
committed by Niklas Haas
parent ca2c5ff412
commit 6336fa3335

View File

@@ -1658,6 +1658,9 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
HTTPContext *s = h->priv_data;
int len;
if (!s->hd)
return AVERROR(EIO);
if (s->chunksize != UINT64_MAX) {
if (s->chunkend) {
return AVERROR_EOF;