start_code will still be invalid, i.e. all ones, but will no longer have
up to the first three bytes in p shifted in.
---
libavcodec/utils.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 54c9dd056d..b4c5fa5009 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -944,19 +944,14 @@ const uint8_t *avpriv_find_start_code(const uint8_t
*av_restrict p,
const uint8_t *end,
uint32_t *av_restrict start_code)
{
- int i;
+ *start_code = ~0;
av_assert0(p <= end);
- if (p >= end)
+ // minimum length for a start code
+ if (p + 4 > end)
return end;
- *start_code = ~0;
- for (i = 0; i < 3; i++) {
- uint32_t tmp = *start_code << 8;
- *start_code = tmp + *(p++);
- if (tmp == 0x100 || p == end)
- return p;
- }
+ p += 3; // offset for negative indices in while loop
/* with memory address increasing left to right, we are looking for (in
hexadecimal):
* 00 00 01 XX
--
2.32.0
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".