History

avformat/webpenc: Check seeks

Addresses the issue reported in ticket #4609.

Andreas Rheinhardt committed 3 years ago

Commit 155f0c81 parent e920a841 file · +7 −6Browse files

Unified · Split

libavformat/webpenc.c+7−6
@@ -177,8 +177,8 @@ static int webp_write_trailer(AVFormatContext *s) · 176 unmodified lines
177 177
178 if (w->using_webp_anim_encoder) {178 if (w->using_webp_anim_encoder) {
179 if (w->loop) { // Write loop count.179 if (w->loop) { // Write loop count.
180 avio_seek(s->pb, 42, SEEK_SET);180 if (avio_seek(s->pb, 42, SEEK_SET) == 42)
181 avio_wl16(s->pb, w->loop);181 avio_wl16(s->pb, w->loop);
182 }182 }
183 } else {183 } else {
184 int ret;184 int ret;
@@ -186,10 +186,11 @@ static int webp_write_trailer(AVFormatContext *s) · 1 unmodified line
186 return ret;186 return ret;
187 187
188 filesize = avio_tell(s->pb);188 filesize = avio_tell(s->pb);
189 avio_seek(s->pb, 4, SEEK_SET);189 if (avio_seek(s->pb, 4, SEEK_SET) == 4) {
190 avio_wl32(s->pb, filesize - 8);190 avio_wl32(s->pb, filesize - 8);
191 // Note: without the following, avio only writes 8 bytes to the file.191 // Note: without the following, avio only writes 8 bytes to the file.
192 avio_seek(s->pb, filesize, SEEK_SET);192 avio_seek(s->pb, filesize, SEEK_SET);
193 }
193 }194 }
194 195
195 return 0;196 return 0;

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