From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BB14A45A09 for ; Wed, 8 Mar 2023 23:38:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1918368BD8A; Thu, 9 Mar 2023 01:37:58 +0200 (EET) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5321A68BD43 for ; Thu, 9 Mar 2023 01:37:52 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 8958FE80F9 for ; Thu, 9 Mar 2023 00:37:53 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3pkir_SPy36v for ; Thu, 9 Mar 2023 00:37:51 +0100 (CET) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id C42BFE7F43 for ; Thu, 9 Mar 2023 00:37:51 +0100 (CET) Date: Thu, 9 Mar 2023 00:37:51 +0100 (CET) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: Message-ID: <482cee52-20e6-ce9d-e16d-ecee3040d433@passwd.hu> References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] libavformat/img2dec: fix unable to find svg format when the svg resources start with " List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Tue, 7 Mar 2023, 1035567130@qq.com wrote: > From: Wang Yaqiang > > svg is xml, but it can start with > Signed-off-by: Wang Yaqiang > --- > libavformat/img2dec.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c > index 5a63d7c81d..448a574b59 100644 > --- a/libavformat/img2dec.c > +++ b/libavformat/img2dec.c > @@ -25,6 +25,7 @@ > #define _DEFAULT_SOURCE > #define _BSD_SOURCE > #include > +#include Please no, use libavutil/avstring.h for av_isspace() instead. > #include "libavutil/avstring.h" > #include "libavutil/log.h" > #include "libavutil/opt.h" > @@ -964,18 +965,19 @@ static int svg_probe(const AVProbeData *p) > { > const uint8_t *b = p->buf; > const uint8_t *end = p->buf + p->buf_size; > - > - if (memcmp(p->buf, " + while (b && b < end && isspace(*b)) b++; av_isspace() > + if (b >= end - 5) return 0; line break before return > + if (memcmp(p->buf, " return 0; Why not simply return AVPROBE_SCORE_EXTENSION + 1 here for the while (b < end) { > int inc = ff_subtitles_next_line(b); > if (!inc) > break; > + if (!memcmp(b, " + return AVPROBE_SCORE_EXTENSION + 1; > b += inc; > if (b >= end - 4) > return 0; > - if (!memcmp(b, " - return AVPROBE_SCORE_EXTENSION + 1; > } > return 0; > } > -- > 2.39.2 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".