From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 4458D4E734
	for <ffmpegdev@gitmailbox.com>; Fri, 14 Mar 2025 20:31:12 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0100368E34B;
	Fri, 14 Mar 2025 22:31:08 +0200 (EET)
Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net
 [217.70.183.199])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E38F68C2E3
 for <ffmpeg-devel@ffmpeg.org>; Fri, 14 Mar 2025 22:31:02 +0200 (EET)
Received: by mail.gandi.net (Postfix) with ESMTPSA id BE67B4327F
 for <ffmpeg-devel@ffmpeg.org>; Fri, 14 Mar 2025 20:31:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1741984261;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=O0eJVzVF7rTYctGVUJWJw7zsabbfkx9UM10nLrrliHY=;
 b=VYUE3vV26QElIs+/dJt3SBScfyD8zrJFO3QXWiHiLHu7QhiWno26y8tKIdiCc208g8tKP2
 Umtua/gagnlInypBrAS/5DPw/A1pXcL9/0whq7u3gYISoAVEd3VVGAFmoMz6sGXOFTAgPw
 z51RlXzr1Pv2vFn08p1pD/9HOaijyeWbLUQjHkrCg09partS0JpX2l0V8PLMoY0cH3tMd/
 /MjnZrbDpIbsu9Yo6KBDHUBzqxGabtyhZmbxa/z+ZQdOEN7Qy1WvbyGKaepqL5FdzKxAEf
 x9+DuI/1qUNPkWkcEujZbVPLfsoLBcf0ieh3gj3NGMs1/rri/O4t5RvXfwABtQ==
Date: Fri, 14 Mar 2025 21:31:00 +0100
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Message-ID: <20250314203100.GM4991@pb2>
References: <20250313111505.166786-1-manuel.lauss@gmail.com>
 <20250313111505.166786-12-manuel.lauss@gmail.com>
MIME-Version: 1.0
In-Reply-To: <20250313111505.166786-12-manuel.lauss@gmail.com>
X-GND-State: clean
X-GND-Score: -85
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufedujeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdduhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: Re: [FFmpeg-devel] [PATCH 11/12] avcodec/sanm: change
 GetByteContext member to pointer
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: multipart/mixed; boundary="===============6132831975387285683=="
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250314203100.GM4991@pb2/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>


--===============6132831975387285683==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="7Q38D8I0OE9LcVei"
Content-Disposition: inline


--7Q38D8I0OE9LcVei
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Manuel

On Thu, Mar 13, 2025 at 12:15:04PM +0100, Manuel Lauss wrote:
> In order do properly support the ANIM STOR/FTCH system, the FTCH
> must replay a stored FOBJ and change the SANMContext's "GetByteContext"
> member temporarily.
>=20
> Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
> ---
>  libavcodec/sanm.c | 394 +++++++++++++++++++++++-----------------------
>  1 file changed, 198 insertions(+), 196 deletions(-)
>=20
> diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
> index a8a3e04156..207db4a8fb 100644
> --- a/libavcodec/sanm.c
> +++ b/libavcodec/sanm.c

[...]

> @@ -2114,10 +2114,12 @@ static int decode_frame(AVCodecContext *avctx, AV=
Frame *frame,
>                          int *got_frame_ptr, AVPacket *pkt)
>  {
>      SANMVideoContext *ctx =3D avctx->priv_data;
> +    GetByteContext gb;
>      int i, ret;
> =20
>      ctx->frame =3D frame;
> -    bytestream2_init(&ctx->gb, pkt->data, pkt->size);
> +    bytestream2_init(&gb, pkt->data, pkt->size);
> +    ctx->gb =3D &gb;

Having a context pointer point to the local stack is fragile
Because the context and pointer have a longer lifetime than the stack

So for a long portion of the time this pointer is totally invalid

thx

[...]
--=20
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin

--7Q38D8I0OE9LcVei
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ9SSBAAKCRBhHseHBAsP
q7jZAJkBF09iKwMsr5/Ihk1POQy7l8/KHACgkQI+5+9kwT9VjwsQvbPTchajYPc=
=ipAr
-----END PGP SIGNATURE-----

--7Q38D8I0OE9LcVei--

--===============6132831975387285683==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
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".

--===============6132831975387285683==--