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

Showing the changes to libavformat (1 of 1 file). Show all

Unified · Split

libavformat/webpenc.c+7−6
@@ -177,8 +177,8 @@ static int webp_write_trailer(AVFormatContext *s) · 176 unmodified lines
177177
178178 if (w->using_webp_anim_encoder) {
179179 if (w->loop) { // Write loop count.
180− avio_seek(s->pb, 42, SEEK_SET);
181− avio_wl16(s->pb, w->loop);
180+ if (avio_seek(s->pb, 42, SEEK_SET) == 42)
181+ avio_wl16(s->pb, w->loop);
182182 }
183183 } else {
184184 int ret;
@@ -186,10 +186,11 @@ static int webp_write_trailer(AVFormatContext *s) · 1 unmodified line
186186 return ret;
187187
188188 filesize = avio_tell(s->pb);
189− avio_seek(s->pb, 4, SEEK_SET);
190− avio_wl32(s->pb, filesize - 8);
191− // Note: without the following, avio only writes 8 bytes to the file.
192− avio_seek(s->pb, filesize, SEEK_SET);
189+ if (avio_seek(s->pb, 4, SEEK_SET) == 4) {
190+ avio_wl32(s->pb, filesize - 8);
191+ // Note: without the following, avio only writes 8 bytes to the file.
192+ avio_seek(s->pb, filesize, SEEK_SET);
193+ }
193194 }
194195
195196 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