Message ID | 20240212162755.43790-1-mattias.wadman@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v1] avcodec/h2645_parse: Don't treat 0x000002 as a start code and truncate | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | fail | Make fate failed |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | fail | Make fate failed |
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c index 28db465059..d54bdd53c2 100644 --- a/libavcodec/h2645_parse.c +++ b/libavcodec/h2645_parse.c @@ -40,8 +40,9 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length, nal->skipped_bytes = 0; #define STARTCODE_TEST \ - if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ - if (src[i + 2] != 3 && src[i + 2] != 0) { \ + if (i + 2 < length && src[i + 1] == 0 && \ + (src[i + 2] == 3 || src[i + 2] == 1)) { \ + if (src[i + 2] == 1) { \ /* startcode, so we must be past the end */ \ length = i; \ } \