Up until now ff_startcode_find_candidate_c could overread; it relied on zero-padding after the buffer in order to function correctly. This has been changed: No overreads occur any more. The ultimate goal behind all this is to create a high-performance function for searching of startcodes that can be applied even in scenarios where the buffer is not padded.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> --- libavcodec/startcode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavcodec/startcode.c b/libavcodec/startcode.c index 373572365b..b027c191c0 100644 --- a/libavcodec/startcode.c +++ b/libavcodec/startcode.c @@ -41,10 +41,7 @@ int ff_startcode_find_candidate_c(const uint8_t *buf, int size) #define READ(bitness) AV_RN ## bitness ## A #define MAIN_LOOP(bitness, mask1, mask2) do { \ - /* we check p < end instead of p + 3 / 7 because it is - * simpler and there must be AV_INPUT_BUFFER_PADDING_SIZE - * bytes at the end. */ \ - for (; buf < end; buf += bitness / 8) \ + for (; buf <= end - bitness / 8; buf += bitness / 8) \ if ((~READ(bitness)(buf) & (READ(bitness)(buf) - mask1)) \ & mask2) \ break; \ -- 2.21.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".