diff mbox

[FFmpeg-devel] lavf/matroskaenc: Do not allow -reserve_index_space 1

Message ID CAB0OVGo7nmS=dvx4XPxGz7DP4Kg2GJTU-D-C3rH=DiRbqhdDyg@mail.gmail.com
State Superseded
Headers show

Commit Message

Carl Eugen Hoyos Feb. 11, 2018, 7:19 p.m. UTC
Hi!

Attached patch fixes an assertion failure with the following command line:
$ ffmpeg -f lavfi -i testsrc -reserve_index_space 1 out.mkv

Please comment, Carl Eugen

Comments

Nicolas George Feb. 11, 2018, 7:23 p.m. UTC | #1
Carl Eugen Hoyos (2018-02-11):
> Attached patch fixes an assertion failure with the following command line:
> $ ffmpeg -f lavfi -i testsrc -reserve_index_space 1 out.mkv
> 
> Please comment, Carl Eugen

Reading the code, it is pretty obvious that 0 is a valid value and
forbidding it would be bad.

By the way, you can write "-lavfi" instead of "-f lavfi -i", unless you
want to test the lavfi device specifically.

Regards,
diff mbox

Patch

From 4566d5f90f24bf2373175a8aad84c82be6b1a9eb Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 11 Feb 2018 20:16:02 +0100
Subject: [PATCH] lavf/matroskaenc: Do not allow -reserve_index_space 1.

Fixes an assertion failure:
Assertion size >= 2 failed at libavformat/matroskaenc.c:298
---
 libavformat/matroskaenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f22c2ab..b0dc4dd 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2726,7 +2726,7 @@  static const AVCodecTag additional_subtitle_tags[] = {
 #define OFFSET(x) offsetof(MatroskaMuxContext, x)
 #define FLAGS AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-    { "reserve_index_space", "Reserve a given amount of space (in bytes) at the beginning of the file for the index (cues).", OFFSET(reserve_cues_space), AV_OPT_TYPE_INT,   { .i64 = 0 },   0, INT_MAX,   FLAGS },
+    { "reserve_index_space", "Reserve a given amount of space (in bytes) at the beginning of the file for the index (cues).", OFFSET(reserve_cues_space), AV_OPT_TYPE_INT,   { .i64 = 0 },   2, INT_MAX,   FLAGS },
     { "cluster_size_limit",  "Store at most the provided amount of bytes in a cluster. ",                                     OFFSET(cluster_size_limit), AV_OPT_TYPE_INT  , { .i64 = -1 }, -1, INT_MAX,   FLAGS },
     { "cluster_time_limit",  "Store at most the provided number of milliseconds in a cluster.",                               OFFSET(cluster_time_limit), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, FLAGS },
     { "dash", "Create a WebM file conforming to WebM DASH specification", OFFSET(is_dash), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
-- 
1.7.10.4