Message ID | 20210220072218.31629-4-yejun.guo@intel.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/8] libavdevice/v4l2.c: fix build warning | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
Quoting Guo, Yejun (2021-02-20 08:22:14) > Part of warning message: > src/libavformat/dashenc.c: In function ‘flush_init_segment’: > src/libavformat/dashenc.c:608:49: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=] > snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); > ^~ > src/libavformat/dashenc.c:608:9: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024 > snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- > libavformat/dashenc.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > All these numbers are pretty arbitrary. Might as well make them dynamically allocated, like AVFormatContext.url is.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 2d757b3a87..b11f79c966 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -126,7 +126,7 @@ typedef struct OutputStream { char codec_str[100]; int written_len; char filename[1024]; - char full_path[1024]; + char full_path[2048]; char temp_path[1024]; double availability_time_offset; AVProducerReferenceTime producer_reference_time; @@ -604,7 +604,7 @@ static int flush_init_segment(AVFormatContext *s, OutputStream *os) os->pos = os->init_range_length = range_length; if (!c->single_file) { - char filename[1024]; + char filename[2048]; snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); dashenc_io_close(s, &os->out, filename); } @@ -1480,7 +1480,7 @@ static int dash_init(AVFormatContext *s) AVFormatContext *ctx; AVStream *st; AVDictionary *opts = NULL; - char filename[1024]; + char filename[2048]; os->bit_rate = s->streams[i]->codecpar->bit_rate; if (!os->bit_rate) {