Fix static analyzer warnings.

Change-Id: I45f0db2310b1188809963af93240e3d438f807b8
This commit is contained in:
Vincent Rabaud
2023-09-14 09:31:19 +02:00
parent a35ea50de4
commit 433c7dca11
11 changed files with 82 additions and 53 deletions

View File

@ -593,16 +593,17 @@ int WebPAnimEncoderRefineRect(
int is_lossless, float quality, int* const x_offset, int* const y_offset,
int* const width, int* const height) {
FrameRectangle rect;
const int right = clip(*x_offset + *width, 0, curr_canvas->width);
const int left = clip(*x_offset, 0, curr_canvas->width - 1);
const int bottom = clip(*y_offset + *height, 0, curr_canvas->height);
const int top = clip(*y_offset, 0, curr_canvas->height - 1);
int right, left, bottom, top;
if (prev_canvas == NULL || curr_canvas == NULL ||
prev_canvas->width != curr_canvas->width ||
prev_canvas->height != curr_canvas->height ||
!prev_canvas->use_argb || !curr_canvas->use_argb) {
return 0;
}
right = clip(*x_offset + *width, 0, curr_canvas->width);
left = clip(*x_offset, 0, curr_canvas->width - 1);
bottom = clip(*y_offset + *height, 0, curr_canvas->height);
top = clip(*y_offset, 0, curr_canvas->height - 1);
rect.x_offset_ = left;
rect.y_offset_ = top;
rect.width_ = clip(right - left, 0, curr_canvas->width - rect.x_offset_);

View File

@ -555,7 +555,8 @@ static WebPMuxError MuxCleanup(WebPMux* const mux) {
if (num_frames == 1) {
WebPMuxImage* frame = NULL;
err = MuxImageGetNth((const WebPMuxImage**)&mux->images_, 1, &frame);
assert(err == WEBP_MUX_OK); // We know that one frame does exist.
if (err != WEBP_MUX_OK) return err;
// We know that one frame does exist.
assert(frame != NULL);
if (frame->header_ != NULL &&
((mux->canvas_width_ == 0 && mux->canvas_height_ == 0) ||