Addresses the issue reported in ticket #4609.
Showing the changes to libavformat (1 of 1 file). Show all
Unified · Split
| @@ -177,8 +177,8 @@ static int webp_write_trailer(AVFormatContext *s) · 176 unmodified lines | ||
| 177 | 177 | |
| 178 | 178 | if (w->using_webp_anim_encoder) { |
| 179 | 179 | 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); | |
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | 184 | int ret; |
| @@ -186,10 +186,11 @@ static int webp_write_trailer(AVFormatContext *s) · 1 unmodified line | ||
| 186 | 186 | return ret; |
| 187 | 187 | |
| 188 | 188 | 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 | + } | |
| 193 | 194 | } |
| 194 | 195 | |
| 195 | 196 | return 0; |