From patchwork Tue Apr 14 20:37:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 18957 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EE288449CA2 for ; Tue, 14 Apr 2020 23:38:51 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C78D468B63C; Tue, 14 Apr 2020 23:38:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1673E68B1EA for ; Tue, 14 Apr 2020 23:38:45 +0300 (EEST) Received: by mail-qk1-f194.google.com with SMTP id y3so14893593qky.8 for ; Tue, 14 Apr 2020 13:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=pK4BYT3MaN9Xhd1GautzNb3QbTtGmkLRL/tDsexI3wU=; b=Rlc0lA209CNmMV1lVQMDGbQTjGDpu2C+gMHYX5hnVnC5fVeX2F9IDMYHmDVq5jaiN3 hsZJ1pLC5nqVgcGaBxf9uOhsyjt006/I+lZz0GMjt1CObZ/ZHhcWv/Wu+4VEaj3isK3k 6lSR01ChLIIkFrpfyaGLEyFLJnmF49vOBrVhTeuu3A45KGeIpAJbIuEkCBzRTVV5MwNu M4wc4QynU+RcUuORsTR1slBnPsddIb29xtxsYvsBPaVMt7+x2RBVsaWCfIXy2clisnoO OU5bXKIMpwVk4ERDC5ae3HpUcvgz9LZB1/ErjKbg3iTmNrKQAWge6aIfF9RwlOeDu8U+ IvcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=pK4BYT3MaN9Xhd1GautzNb3QbTtGmkLRL/tDsexI3wU=; b=Li0tHzPPWFBzHketryMizVa+xWNpSCMTLl+Cvd3Dcvlx0U3KvXk0v2N6M0lJSsVI0s YG2jRW07ZqepBcCy8RZqrM4E3cLVH441hdGHwAcqM+Tw2s4cLa38z5qEWq3K1PfTfGRx 3GSzSb06tRSlY9ku6j+PooVGhUPsxpokArkq1iCP//HA9EvKZBGA4B68ftGEvZrn/9ll pp/jR22BNpZKx5ARhA3NGZNOkNIFxoa4iLYCJygsMYFiNSJ1c/oP4ng0xN9/DyR5gHKH oGPCZWxxOPfli4Y/MBTYmKiTTXK7MQRdekdin7EK/98CT2HEg7/prAl3F/9inixrISYv MjyQ== X-Gm-Message-State: AGi0PubzBMMpX+rEj5R2Pmft5UC2aUmHoYl3CulpGlZPcZkYx7aLbNhd yqBnwwgOhVBUbAUIkNKkDk2q/Db3 X-Google-Smtp-Source: APiQypLOiZ/Mxjro6Sb0TsVbTHye7TcE5H0os7nM3xmuwKYR1spz6bren+Dd2krRQKfnOSx0/E219Q== X-Received: by 2002:a37:95c6:: with SMTP id x189mr22299419qkd.19.1586896723525; Tue, 14 Apr 2020 13:38:43 -0700 (PDT) Received: from localhost.localdomain ([191.83.216.57]) by smtp.gmail.com with ESMTPSA id v62sm2187426qkb.85.2020.04.14.13.38.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 13:38:42 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 14 Apr 2020 17:37:33 -0300 Message-Id: <20200414203733.4578-1-jamrial@gmail.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/movenc: remove call to av_copy_packet_side_data() when concatenatic eac3 syncframes X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This generates a potential memory leak if info->pkt already contains side data elements, and may mix side data from the last packet with other properties from the first. Keep all the properties from the first packet only in the output packet instead. Signed-off-by: James Almer --- The alternative is to keep all the properties of the last packet instead of the first, or merge the side data from all packets into the output packet, giving priority to the either the first or the last in case of duplicate side data types. I have no idea what would be ideal since i don't have a sample that triggers this code, and i don't know what kind of side data these eac3 packets could contain that one would need to choose between them. libavformat/movenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index bc8d08044e..bf3e4fa2ce 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -520,8 +520,6 @@ concatenate: memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size); info->num_blocks += num_blocks; info->pkt.duration += pkt->duration; - if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0) - goto end; if (info->num_blocks != 6) goto end; av_packet_unref(pkt);