diff options
author | Harish Mahendrakar <harish.mahendrakar@ittiam.com> | 2015-09-01 13:36:06 +0530 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2015-10-09 11:44:26 -0700 |
commit | 137754b36243967714bd23e3c02ef0c44bce5b7b (patch) | |
tree | 1dbdb3eb1c2c99902bfd3de893256a1dc07dcca1 /decoder | |
parent | 2938759aaa3954f320fb08a381b8c67f558cdeb9 (diff) | |
download | android_external_libhevc-137754b36243967714bd23e3c02ef0c44bce5b7b.tar.gz android_external_libhevc-137754b36243967714bd23e3c02ef0c44bce5b7b.tar.bz2 android_external_libhevc-137754b36243967714bd23e3c02ef0c44bce5b7b.zip |
Memset 8 extra bytes at the end of internal bitstream buffer
Decoder may read 8 extra bytes at the end of this buffer.
Though it will never be used, setting it to zero will ensure
unitialized reads are avoided
Change-Id: Id7bf81ea73718a677c326e352ad3f4dc1756601a
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/ihevcd_decode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/decoder/ihevcd_decode.c b/decoder/ihevcd_decode.c index c2cec1e..d12051a 100644 --- a/decoder/ihevcd_decode.c +++ b/decoder/ihevcd_decode.c @@ -577,6 +577,13 @@ WORD32 ihevcd_decode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op) ps_codec->pu1_bitsbuf, bytes_remaining, &nal_len, &bits_len); + + /* Decoder may read upto 8 extra bytes at the end of frame */ + /* These are not used, but still set them to zero to avoid uninitialized reads */ + if(bits_len < (WORD32)(ps_codec->u4_bitsbuf_size - 8)) + { + memset(ps_codec->pu1_bitsbuf + bits_len, 0, 2 * sizeof(UWORD32)); + } } /* This may be used to update the offsets for tiles and entropy sync row offsets */ ps_codec->i4_num_emln_bytes = nal_len - bits_len; |