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 12010449E7 for ; Wed, 28 Sep 2022 20:46:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BB5D668BC19; Wed, 28 Sep 2022 23:46:49 +0300 (EEST) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BD3C268BBAB for ; Wed, 28 Sep 2022 23:46:42 +0300 (EEST) Received: by mail-ot1-f52.google.com with SMTP id x23-20020a056830409700b00655c6dace73so8917823ott.11 for ; Wed, 28 Sep 2022 13:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date; bh=/AQ9psAOcKpoeTQ4QZNId3UoIzpZeCn5R4qrHvjSjU0=; b=qIEf6Pd2OgpjQlFYBcnHs6dXUQ39riinanLjcUNI7i5CmRJb9TGgGfp+MYLjTGS41q zaHGSbtjttM1rD0/IHQ+av6CLZ62Mz533MoDOc3vV9oMZygGbQBsUSA5XUwm85wg4/aw LjKWJPjOWLRKV5003IEMLmmv7TLwno8V6BFqShtkJpAfK04mD3N/wKeC4r+fJ9ogtTO/ 8eT1+K0O9//3gO/F0nmCa3YcoxBtzwJDkmcGAjeE/dqmh741rSVSUpTk1szlg29gpF7V T6oRKuG6l6VbAaZDDtXugIn1PXSx2qaoy+V6omq0isNheabdtCspprZuVna7qQ5Y0jNm Y7bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=/AQ9psAOcKpoeTQ4QZNId3UoIzpZeCn5R4qrHvjSjU0=; b=US4Nou0TtZrN7sJJlwPGpgPuwlFXNmzGuz5hV9+VL9lfhIvb3BDeJdzmKNO2GU0Ux2 ijmlLybRmX2eoUwjv4KQW5blMHXKxK/Zf7tZddZC/e/QX+z7ORFgiX95TF93HOPPArlM LkFImU6KSuWKSKmxkGWvURF11kZ1UDuIP9camcAojIU1WRc4py5b23aPOV4MXzmlbSNe gXp4WmdtOnbcPu1GG+wSiOZLEpjgk2KCZpYQrhQXYnnMTeSc3Q0fgwnISd5fFhVJLsBQ 09vhMlt3Rj7KbLuOhRcJjgxqSV8xBLJgFEqqnP6jwnfMqV/YzHtJrDDFXnFa+ZGCHipG GA9w== X-Gm-Message-State: ACrzQf1HAmKnSIneH1b0OeZt0AqaMSwWkAHovOtyg2+G7UTH29095l6K pTQq391PwGTv1Wzyox//XmXLa4LkICs= X-Google-Smtp-Source: AMsMyM4EI4KYjwhf53Qlj1SvP/mof5ee25p3FzugqaGicUOhy+78Q/W1ipBVShv8KWV7JUpzbN7sWQ== X-Received: by 2002:a9d:5e8e:0:b0:65a:275c:7979 with SMTP id f14-20020a9d5e8e000000b0065a275c7979mr16205186otl.3.1664398000648; Wed, 28 Sep 2022 13:46:40 -0700 (PDT) Received: from [192.168.0.13] ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id 94-20020a9d0f67000000b00657daa70c37sm2589485ott.25.2022.09.28.13.46.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Sep 2022 13:46:40 -0700 (PDT) Message-ID: <81093ec6-dce9-2d38-d90f-d900667b0658@gmail.com> Date: Wed, 28 Sep 2022 17:46:36 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 3/6] avformat/aviobuf: Don't use NULL as src for memcpy X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches 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 9/28/2022 3:58 PM, Andreas Rheinhardt wrote: > This might happen in avio_write() if size == 0 > when the direct codepath is taken. It is undefined behaviour > according to the spec although it happens to work in practice. > Fixes the webm-webvtt-remux FATE-test under UBSan. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/aviobuf.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c > index b20b1a611a..5b6a42d7f4 100644 > --- a/libavformat/aviobuf.c > +++ b/libavformat/aviobuf.c > @@ -231,6 +231,8 @@ void ffio_fill(AVIOContext *s, int b, int64_t count) > > void avio_write(AVIOContext *s, const unsigned char *buf, int size) > { > + if (size <= 0) > + return; > if (s->direct && !s->update_checksum) { > avio_flush(s); > writeout(s, buf, size); > @@ -246,7 +248,7 @@ void avio_write(AVIOContext *s, const unsigned char *buf, int size) > > buf += len; > size -= len; > - } > + } while (size > 0); Why are you adding this at the end of a similar while statement? Did you mean to replace the previous one with do()? > } > > void avio_flush(AVIOContext *s) _______________________________________________ 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".