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 D02B846D0B for ; Wed, 9 Aug 2023 11:32:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 585FD68C7F4; Wed, 9 Aug 2023 14:32:49 +0300 (EEST) Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B3A7B68C7DF for ; Wed, 9 Aug 2023 14:32:42 +0300 (EEST) Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-1c034d9eb14so594182fac.0 for ; Wed, 09 Aug 2023 04:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691580760; x=1692185560; 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:message-id:reply-to; bh=qbQmo/kObpzpNHfcpo9z5HGlA/J/AvmdDrqeddazV1A=; b=U9eUD2ZTdbdMrg5S+7of0tH6gleBGzO0iM6+FnK+MYzqnuZg+gN+hycZc5mDYttb2B xsNbc1lIkUZKMq9bGs0lrlo0U/qx6jAomdK0to+0bpdf30MLb28ZrQUpwucnIyOxqW1n L/5knWaI9pPcBjQHz/sc7X7QT5rJhGlStGIFaAR0pNw/7cqQ6S7t8gDBcYjxBn1ZnugN kh5gf6boOoP4za5lvRL4ZeKDlJoRR7DFwi4h9Zc3BBrf25Q8Y8Gf3dbmjfGQReHTDH3B 4q54PrMo9M84gViEGK6Vasa8NK+PH7RiiMW5qkKauSZpqqPqHpc4otWbs1q+zvhVHVhs 6Qrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691580760; x=1692185560; 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:message-id:reply-to; bh=qbQmo/kObpzpNHfcpo9z5HGlA/J/AvmdDrqeddazV1A=; b=aCb1fWBZ6/DWLkOvsB6C+QfW8IcT30G2WS1VjsRoYR5RS17EjdeVUiNpbq1Ban0Lqc DgQSe5e7d5mO2N6pdAPgXzQsoWEeR5oo08BFcnSzAMmKXr3I/ENSXC97Tn7mECVOudiU P26ujO7xBWrK22G0/0Pki7xMqNPQIyHD9QH9+s+HQJKZausADWVl1xR2Njs+bv9svO2z 22uLZNFHmWcbOdENXmpIfgqLcyhoL8EuK9+MdAmK4KuLMN1INc4zfAg4xCFwrCNlJZA4 sZukfJYX5Cd0Oxh2c3It8I+ywsx8VPF0MYRxOEOL4phJDhUtq8KSZux8AyMX/SeiLJ6C j4PQ== X-Gm-Message-State: AOJu0YysOJgbKJQn+e84lMBGZ7Ohtx4VrlfsY3LjUsAhHnxgyCVD/1Rp 5mjVSdSiP4j1NRgeU6KX7bB+c7xqYW4= X-Google-Smtp-Source: AGHT+IGHuTY4e0IBFxr/KDNuAztki+wkO5mTqaPsVxONuaeziwvS/fzuniJ13DRk+AeNPsi09NJpNw== X-Received: by 2002:a05:6870:65a1:b0:1ba:3a7f:50eb with SMTP id fp33-20020a05687065a100b001ba3a7f50ebmr2303983oab.22.1691580760521; Wed, 09 Aug 2023 04:32:40 -0700 (PDT) Received: from [192.168.0.16] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id v17-20020a056870955100b001bee99e97a9sm7036597oal.43.2023.08.09.04.32.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Aug 2023 04:32:40 -0700 (PDT) Message-ID: Date: Wed, 9 Aug 2023 08:32:40 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 2/7] avutil/bprint: Allow size == 0 in av_bprint_init_for_buffer() 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 8/9/2023 7:08 AM, Nicolas George wrote: > Andreas Rheinhardt (12023-08-06): >> The AVBPrint API guarantees that the string buffer is always >> zero-terminated; in order to honour this guarantee, there >> obviously must be a string buffer at all and it must have >> a size >= 1. Therefore av_bprint_init_for_buffer() treats >> passing a NULL buffer or size == 0 as invalid data that >> leads to undefined behaviour, namely NPD in case NULL is provided >> or a write to a buffer of size 0 in case size == 0. >> >> But it would be easy to support this, namely by using the internal >> buffer with AV_BPRINT_SIZE_COUNT_ONLY in case size == 0. >> >> There is a reason to allow this: Several functions like >> av_channel_(description|name) are actually wrappers >> around corresponding AVBPrint functions. They accept user >> provided buffers and are supposed to return the required >> size of the buffer, which would allow the user to call >> it once to get the required buffer size and call it once >> more after having allocated the buffer. >> If av_bprint_init_for_buffer() treats size == 0 as invalid, >> all these users would need to check for this themselves >> and basically add the same codeblock that this patch >> adds to av_bprint_init_for_buffer(). >> >> This change is in line with e.g. snprintf() which also allows >> the pointer to be NULL in case size is zero. >> >> This fixes Coverity issues #1503074, #1503076 and #1503082; >> all of these issues are about providing NULL to the channel-layout >> functions that are wrappers around AVBPrint versions. >> >> Signed-off-by: Andreas Rheinhardt >> --- >> Missing lavu minor version bump. > > Looks good to me. > > The other patches in the series too, but I do not maintain the channel > layouts. > > Regards, The layout patches are ok too. _______________________________________________ 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".