Michael On Fri, Mar 14, 2025 at 9:31 PM Michael Niedermayer <mich...@niedermayer.cc> wrote: > > 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. > > > > Signed-off-by: Manuel Lauss <manuel.la...@gmail.com> > > --- > > libavcodec/sanm.c | 394 +++++++++++++++++++++++----------------------- > > 1 file changed, 198 insertions(+), 196 deletions(-) > > > > 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, > > AVFrame *frame, > > int *got_frame_ptr, AVPacket *pkt) > > { > > SANMVideoContext *ctx = avctx->priv_data; > > + GetByteContext gb; > > int i, ret; > > > > ctx->frame = frame; > > - bytestream2_init(&ctx->gb, pkt->data, pkt->size); > > + bytestream2_init(&gb, pkt->data, pkt->size); > > + ctx->gb = &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
I see your point, however the GetByteContext is only ever used during this decode_frame() function, never outside of it. But, I'll think of something else. Danke dir! Manuel _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".