[FFmpeg-devel] [PATCH] avformat/aviobuf: initialize all checksum fields
James Almer
jamrial at gmail.com
Wed Feb 14 02:54:49 EET 2018
Calling ffio_ensure_seekback() right after initializing an AVIOContext
with ffio_init_context() would result in a use of uninitialised value.
Fixes fate-adts-id3v2-demux when using valgrind.
Signed-off-by: James Almer <jamrial at gmail.com>
---
Maybe we should do a memset(s, 0, sizeof(*s)) at the beginning of
ffio_init_context() instead, to effectively initialize every field to
zero. Which is prefered?
libavformat/aviobuf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 86eb6579f4..a5ce9b9bf2 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -106,6 +106,8 @@ int ffio_init_context(AVIOContext *s,
s->seekable = seek ? AVIO_SEEKABLE_NORMAL : 0;
s->min_packet_size = 0;
s->max_packet_size = 0;
+ s->checksum = 0;
+ s->checksum_ptr = NULL;
s->update_checksum = NULL;
s->short_seek_threshold = SHORT_SEEK_THRESHOLD;
--
2.16.1
More information about the ffmpeg-devel
mailing list