summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2022-07-26 19:26:23 -0700
committerJames Zern <jzern@google.com>2022-07-27 15:37:11 -0700
commited78231aa54c131018c0c9415cf416beac97a698 (patch)
treea69ed15b3d6b9c85becf0a314872d754f11007b3
parent1c0c4d51b474585d05b36d2d70af6b20f507c931 (diff)
downloadlibvpx-ed78231aa54c131018c0c9415cf416beac97a698.tar
libvpx-ed78231aa54c131018c0c9415cf416beac97a698.tar.gz
libvpx-ed78231aa54c131018c0c9415cf416beac97a698.tar.bz2
libvpx-ed78231aa54c131018c0c9415cf416beac97a698.zip
vp9,decoder_decode: fix ubsan null/zero offset warning
reported under clang-13. null data may be passed as a flush; move data_end after that check vp9/vp9_dx_iface.c:337:40: runtime error: applying zero offset to null pointer Bug: b/229626362 Change-Id: I845726fd6eb6ac7a776e49272c6477a5ad30ffdf
-rw-r--r--vp9/vp9_dx_iface.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c
index 3c42c7dfe..bdfe21793 100644
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -334,7 +334,6 @@ static vpx_codec_err_t decoder_decode(vpx_codec_alg_priv_t *ctx,
const uint8_t *data, unsigned int data_sz,
void *user_priv, long deadline) {
const uint8_t *data_start = data;
- const uint8_t *const data_end = data + data_sz;
vpx_codec_err_t res;
uint32_t frame_sizes[8];
int frame_count;
@@ -362,6 +361,7 @@ static vpx_codec_err_t decoder_decode(vpx_codec_alg_priv_t *ctx,
// Decode in serial mode.
if (frame_count > 0) {
+ const uint8_t *const data_end = data + data_sz;
int i;
for (i = 0; i < frame_count; ++i) {
@@ -379,6 +379,7 @@ static vpx_codec_err_t decoder_decode(vpx_codec_alg_priv_t *ctx,
data_start += frame_size;
}
} else {
+ const uint8_t *const data_end = data + data_sz;
while (data_start < data_end) {
const uint32_t frame_size = (uint32_t)(data_end - data_start);
const vpx_codec_err_t res =