occasionally crashes encode with the SEI data #183

Closed
opened 2025-12-23 10:35:19 +01:00 by backuprepo · 2 comments
Owner

Originally created by @barryzheng on GitHub (Jun 27, 2025).

Descripiton:
When encoding, I use the av_frame_make_writable and av_frame_new_side_data interfaces to add SEI information. After encoding, when releasing the AVFrame resources using av_frame_unref, the program occasionally crashes. The stack trace indicates that the issue occurs when freeing the resources wipe_side_data , error shown:

free(): invalid next size (fast).

`

(gdb) bt

#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x0000007ff51c8aac in __GI_abort () at abort.c:79
#2 0x0000007ff5215f50 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ff52d76e8 "%s\n") at ../sysdeps/posix/libc_fatal.c:156
#3 0x0000007ff521d354 in malloc_printerr (str=str@entry=0x7ff52d31e8 "free(): invalid next size (fast)") at malloc.c:5347
#4 0x0000007ff521ec08 in _int_free (av=0x7e88000020, p=0x7e88005db0, have_lock=0) at malloc.c:4249
#5 0x0000007ff57fb0d4 in av_buffer_default_free (opaque=0x0, data=0x7e88005dc0 "...") at libavutil/buffer.c:74
#6 0x0000007ff57fb31c in buffer_replace (dst=0x7e800163f0, src=0x0) at libavutil/buffer.c:133
#7 0x0000007ff57fb370 in av_buffer_unref (buf=0x7e800163f0) at libavutil/buffer.c:144
#8 0x0000007ff5808860 in free_side_data (ptr_sd=0x7e800043a0) at libavutil/frame.c:73
#9 wipe_side_data (frame=) at libavutil/frame.c:81
#10 av_frame_unref (frame=) at libavutil/frame.c:627
#11 av_frame_unref (frame=0x55559a2d70) at libavutil/frame.c:622

`
please check it, Thanks.

Originally created by @barryzheng on GitHub (Jun 27, 2025). **Descripiton:** When encoding, I use the `av_frame_make_writable ` and `av_frame_new_side_data `interfaces to add SEI information. After encoding, when releasing the AVFrame resources using `av_frame_unref`, the program occasionally crashes. The stack trace indicates that the issue occurs when freeing the resources `wipe_side_data `, error shown: > free(): invalid next size (fast). ` > (gdb) bt > #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 > #1 0x0000007ff51c8aac in __GI_abort () at abort.c:79 > #2 0x0000007ff5215f50 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ff52d76e8 "%s\n") at ../sysdeps/posix/libc_fatal.c:156 > #3 0x0000007ff521d354 in malloc_printerr (str=str@entry=0x7ff52d31e8 "free(): invalid next size (fast)") at malloc.c:5347 > #4 0x0000007ff521ec08 in _int_free (av=0x7e88000020, p=0x7e88005db0, have_lock=0) at malloc.c:4249 > #5 0x0000007ff57fb0d4 in av_buffer_default_free (opaque=0x0, data=0x7e88005dc0 "...") at libavutil/buffer.c:74 > #6 0x0000007ff57fb31c in buffer_replace (dst=0x7e800163f0, src=0x0) at libavutil/buffer.c:133 > #7 0x0000007ff57fb370 in av_buffer_unref (buf=0x7e800163f0) at libavutil/buffer.c:144 > #8 0x0000007ff5808860 in free_side_data (ptr_sd=0x7e800043a0) at libavutil/frame.c:73 > #9 wipe_side_data (frame=<optimized out>) at libavutil/frame.c:81 > #10 av_frame_unref (frame=<optimized out>) at libavutil/frame.c:627 > #11 av_frame_unref (frame=0x55559a2d70) at libavutil/frame.c:622 > ` please check it, Thanks.
backuprepo 2025-12-23 10:35:19 +01:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@nyanmisaka commented on GitHub (Jun 27, 2025):

According to the logs, the crash happens outside of rkmppenc.c. I don't see a direct correlation that this is due to rkmpp encoder. rkmpp won't modify sidedata that you create and allocate yourself.

Also try to verify your program with software encoders - libx264 and libx265.

@nyanmisaka commented on GitHub (Jun 27, 2025): According to the logs, the crash happens outside of `rkmppenc.c`. I don't see a direct correlation that this is due to rkmpp encoder. rkmpp won't modify sidedata that you create and allocate yourself. Also try to verify your program with software encoders - libx264 and libx265.
Author
Owner

@nyanmisaka commented on GitHub (Jul 1, 2025):

Any updates?

@nyanmisaka commented on GitHub (Jul 1, 2025): Any updates?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/ffmpeg-rockchip#183
No description provided.