History

avformat/rmdec: Actually return value < 0 on read_header failure

The RealMedia demuxer's read_header function initially initializes ret, the variable designated for the return variable to -1. Afterwards, chunks of the file are parsed in a loop until an error happens or until the actual frame data is encountered. If the first function whose return value is put into ret doesn't fail, then ret contains a value >= 0 (actually == 0) and this is what will be returned if an error is encountered afterwards. This is a regression since 35bbc1955a58ba74552c50d9161084644f00bbd3. Before that, ret had never been overwritten with a nonnegative value.

Andreas Rheinhardt committed 6 years ago

Commit 4cc43d31 parent ea45d6e1 file · +5 −3Browse files

Unified · Split

libavformat/rmdec.c+5−3
@@ -538,7 +538,7 @@ static int rm_read_header(AVFormatContext *s) · 537 unmodified lines
538538 unsigned int data_off = 0, indx_off = 0;
539539 char buf[128], mime[128];
540540 int flags = 0;
541− int ret = -1;
541+ int ret;
542542 unsigned size, v;
543543 int64_t codec_pos;
544544
@@ -554,6 +554,7 @@ static int rm_read_header(AVFormatContext *s) · 9 unmodified lines
554554 avio_skip(pb, tag_size - 8);
555555
556556 for(;;) {
557+ ret = AVERROR_INVALIDDATA;
557558 if (avio_feof(pb))
558559 goto fail;
559560 tag = avio_rl32(pb);
@@ -619,8 +620,9 @@ static int rm_read_header(AVFormatContext *s) · 59 unmodified lines
619620 avio_seek(pb, codec_pos + size, SEEK_SET);
620621 } else {
621622 avio_skip(pb, -4);
622− if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
623− size, mime) < 0)
623+ ret = ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
624+ size, mime);
625+ if (ret < 0)
624626 goto fail;
625627 }
626628

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t