[vlc-devel] [PATCH] copy: assert copy_pitch is not null

Alexandre Janniaux ajanni at videolabs.io
Fri Nov 22 16:39:05 CET 2019


copy_pitch = 0 is a developer error which leads to a bad configuration
of the filter and a division by zero. It can come from a badly
configured video format conversion.
---
 modules/video_chroma/copy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index 57e2ba2385..2ad9d2b7a7 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -466,6 +466,7 @@ static void SSE_CopyPlane(uint8_t *dst, size_t dst_pitch,
                           unsigned height, int bitshift)
 {
     const size_t copy_pitch = __MIN(src_pitch, dst_pitch);
+    assert(copy_pitch > 0);
     const unsigned w16 = (copy_pitch+15) & ~15;
     const unsigned hstep = cache_size / w16;
     const unsigned cache_width = __MIN(src_pitch, cache_size);
-- 
2.24.0



More information about the vlc-devel mailing list