History

avutil/frame: Fix direct pointer compare between different array

Zhao Zhili committed 1 year ago

Commit 88d9eca1 parent f926b601 file · +8 −4Browse files

Unified · Split

libavutil/frame.c+8−4
@@ -730,7 +730,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src) · 729 unmodified lines
730730
731731 AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane)
732732 {
733− uint8_t *data;
733+ uintptr_t data;
734734 int planes;
735735
736736 if (frame->nb_samples) {
@@ -743,16 +743,20 @@ AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane) · 6 unmodified lines
743743
744744 if (plane < 0 || plane >= planes || !frame->extended_data[plane])
745745 return NULL;
746− data = frame->extended_data[plane];
746+ data = (uintptr_t)frame->extended_data[plane];
747747
748748 for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++) {
749749 AVBufferRef *buf = frame->buf[i];
750− if (data >= buf->data && data < buf->data + buf->size)
750+ uintptr_t buf_begin = (uintptr_t)buf->data;
751+
752+ if (data >= buf_begin && data < buf_begin + buf->size)
751753 return buf;
752754 }
753755 for (int i = 0; i < frame->nb_extended_buf; i++) {
754756 AVBufferRef *buf = frame->extended_buf[i];
755− if (data >= buf->data && data < buf->data + buf->size)
757+ uintptr_t buf_begin = (uintptr_t)buf->data;
758+
759+ if (data >= buf_begin && data < buf_begin + buf->size)
756760 return buf;
757761 }
758762 return NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t