提交 a09bb3ba 编写于 作者: M Mans Rullgard

lavc: avoid invalid memcpy() in avcodec_default_release_buffer()

When the buf and last pointers are equal, the FFSWAP() results
in an invalid call to memcpy() with same source and destination
on some targets.  Although assigning a struct to itself is valid
C99, gcc does not check for this before calling memcpy().
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667Signed-off-by: NMans Rullgard <mans@mansr.com>
上级 3383a53e
......@@ -509,7 +509,8 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
avci->buffer_count--;
last = &avci->buffer[avci->buffer_count];
FFSWAP(InternalBuffer, *buf, *last);
if (buf != last)
FFSWAP(InternalBuffer, *buf, *last);
}
for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册