matroska: Read only the data written in the scratch buffer
authorLuca Barbato <lu_zero@gentoo.org>
Fri, 7 Apr 2017 09:41:27 +0000 (11:41 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 10 Apr 2017 08:16:40 +0000 (10:16 +0200)
The private buffer is 20bytes but depending on the type only 12 bytes
are actually filled.

libavformat/matroskaenc.c

index 34d9833..b8c434a 100644 (file)
@@ -686,7 +686,7 @@ static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb,
         avio_wb32(&b, spherical->bound_left);
         avio_wb32(&b, spherical->bound_right);
         put_ebml_binary(dyn_cp, MATROSKA_ID_VIDEOPROJECTIONPRIVATE,
-                        private, sizeof(private));
+                        private, avio_tell(&b));
         break;
     case AV_SPHERICAL_CUBEMAP:
         ffio_init_context(&b, private, 12, 1, NULL, NULL, NULL, NULL);
@@ -696,7 +696,7 @@ static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb,
         avio_wb32(&b, 0); // layout
         avio_wb32(&b, spherical->padding);
         put_ebml_binary(dyn_cp, MATROSKA_ID_VIDEOPROJECTIONPRIVATE,
-                        private, sizeof(private));
+                        private, avio_tell(&b));
         break;
     default:
         av_log(s, AV_LOG_WARNING, "Unknown projection type\n");