diff mbox series

[FFmpeg-devel,5/9] avutil/buffer: Never poison returned buffers

Message ID DB6PR0101MB2214DDB8F9D6E0435D5773708F629@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Headers show
Series [FFmpeg-devel,1/9] avcodec/wmv2dec: Zero mb_type array for I pictures | expand


Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 9, 2022, 6:34 p.m. UTC
Poisoning returned buffers is based around the implicit assumption
that the contents of said buffers are transient. Yet this is not true
for the buffer pools used by the various hardware contexts which store
important state in there that needs to be preserved.
Furthermore, the current code is also based on the assumption
that the complete buffer pointed to by AVBuffer->data coincides with
AVBufferRef->data; yet an implementation might store some data of its
own before the actual user-visible data (accessible via AVBufferRef)
which would be broken by the current code.

(This is of course yet more proof that the AVBuffer API is not the right
tool for the hardware contexts.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
I already sent this patch last October, but didn't apply it
due to lack of feedback. Future patches of mine depend upon
this and therefore I am sending it again.

 libavutil/buffer.c | 3 ---
 1 file changed, 3 deletions(-)
diff mbox series


diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 54590be566..e4562a79b1 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -341,9 +341,6 @@  static void pool_release_buffer(void *opaque, uint8_t *data)
     BufferPoolEntry *buf = opaque;
     AVBufferPool *pool = buf->pool;
-        memset(buf->data, FF_MEMORY_POISON, pool->size);
     buf->next = pool->pool;
     pool->pool = buf;