From b84a7330af41cec93384bf59ed68c67b09d105cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Fri, 10 Jan 2014 01:51:22 +0100 Subject: [PATCH] avformat/pjsdec: dont increase pointer when its already at the end in read_ts() Fixes use of uninitialized memory Fixes: msan_uninit-mem_7f91f2de7764_2649_PJS_capability_tester.pjs Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavformat/pjsdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/pjsdec.c b/libavformat/pjsdec.c index a69a31660d..6f5db37886 100644 --- a/libavformat/pjsdec.c +++ b/libavformat/pjsdec.c @@ -53,7 +53,8 @@ static int64_t read_ts(char **line, int *duration) int64_t start, end; if (sscanf(*line, "%"SCNd64",%"SCNd64, &start, &end) == 2) { - *line += strcspn(*line, "\"") + 1; + *line += strcspn(*line, "\""); + *line += !!**line; *duration = end - start; return start; }