mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-22 12:02:47 +01:00
Avoid nullptr arithmetic in VP8BitReaderSetBuffer
When start is nullptr, the IO is not used afterwards anyway, so there is not risk. Change-Id: I0a828aec85c6e228e95dfed4a40d348275a7c577
This commit is contained in:
parent
f8f2410710
commit
654bfb040c
@ -15,6 +15,8 @@
|
||||
#include "src/webp/config.h"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "src/dsp/cpu.h"
|
||||
#include "src/utils/bit_reader_inl_utils.h"
|
||||
#include "src/utils/utils.h"
|
||||
@ -25,11 +27,12 @@
|
||||
void VP8BitReaderSetBuffer(VP8BitReader* const br,
|
||||
const uint8_t* const start,
|
||||
size_t size) {
|
||||
br->buf_ = start;
|
||||
br->buf_end_ = start + size;
|
||||
br->buf_max_ =
|
||||
(size >= sizeof(lbit_t)) ? start + size - sizeof(lbit_t) + 1
|
||||
: start;
|
||||
if (start != NULL) {
|
||||
br->buf_ = start;
|
||||
br->buf_end_ = start + size;
|
||||
br->buf_max_ =
|
||||
(size >= sizeof(lbit_t)) ? start + size - sizeof(lbit_t) + 1 : start;
|
||||
}
|
||||
}
|
||||
|
||||
void VP8InitBitReader(VP8BitReader* const br,
|
||||
|
Loading…
x
Reference in New Issue
Block a user