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=32667

Signed-off-by: Mans Rullgard <mans@mansr.com>
pull/2/head
Mans Rullgard 13 years ago
parent 3383a53e7d
commit a09bb3ba5e
  1. 1
      libavcodec/utils.c

@ -509,6 +509,7 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
avci->buffer_count--;
last = &avci->buffer[avci->buffer_count];
if (buf != last)
FFSWAP(InternalBuffer, *buf, *last);
}

Loading…
Cancel
Save