mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Merge "VP8[L]GetInfo: check input pointers"
This commit is contained in:
commit
9a214fa112
@ -84,7 +84,7 @@ int VP8SetError(VP8Decoder* const dec,
|
||||
|
||||
int VP8GetInfo(const uint8_t* data, size_t data_size, size_t chunk_size,
|
||||
int* width, int* height) {
|
||||
if (data_size < 10) {
|
||||
if (data == NULL || data_size < VP8_FRAME_HEADER_SIZE) {
|
||||
return 0; // not enough data
|
||||
}
|
||||
// check signature
|
||||
|
@ -96,7 +96,7 @@ static int ReadImageSize(VP8LBitReader* const br,
|
||||
|
||||
int VP8LGetInfo(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
if (data_size < kHeaderBytes) {
|
||||
if (data == NULL || data_size < kHeaderBytes) {
|
||||
return 0; // not enough data
|
||||
} else {
|
||||
int w, h;
|
||||
@ -105,8 +105,8 @@ int VP8LGetInfo(const uint8_t* data, size_t data_size,
|
||||
if (!ReadImageSize(&br, &w, &h)) {
|
||||
return 0;
|
||||
}
|
||||
*width = w;
|
||||
*height = h;
|
||||
if (width != NULL) *width = w;
|
||||
if (height != NULL) *height = h;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user