mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-21 19:32:52 +01:00
fix indent
after: 277d3074 Fix size_t overflow in WebPRescalerInit Change-Id: I9adf7f01f28ddd54305512762e2ed28713282966 (cherry picked from commit d2caaba435f0e819e5e43b5de678b6b1a266a323)
This commit is contained in:
parent
731246ba3b
commit
53b6f76209
@ -331,13 +331,13 @@ static int InitYUVRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
|||||||
p->scaler_a = has_alpha ? &scalers[3] : NULL;
|
p->scaler_a = has_alpha ? &scalers[3] : NULL;
|
||||||
|
|
||||||
if (!WebPRescalerInit(p->scaler_y, io->mb_w, io->mb_h,
|
if (!WebPRescalerInit(p->scaler_y, io->mb_w, io->mb_h,
|
||||||
buf->y, out_width, out_height, buf->y_stride, 1,
|
buf->y, out_width, out_height, buf->y_stride, 1,
|
||||||
work) ||
|
work) ||
|
||||||
!WebPRescalerInit(p->scaler_u, uv_in_width, uv_in_height,
|
!WebPRescalerInit(p->scaler_u, uv_in_width, uv_in_height,
|
||||||
buf->u, uv_out_width, uv_out_height, buf->u_stride, 1,
|
buf->u, uv_out_width, uv_out_height, buf->u_stride, 1,
|
||||||
work + work_size) ||
|
work + work_size) ||
|
||||||
!WebPRescalerInit(p->scaler_v, uv_in_width, uv_in_height,
|
!WebPRescalerInit(p->scaler_v, uv_in_width, uv_in_height,
|
||||||
buf->v, uv_out_width, uv_out_height, buf->v_stride, 1,
|
buf->v, uv_out_width, uv_out_height, buf->v_stride, 1,
|
||||||
work + work_size + uv_work_size)) {
|
work + work_size + uv_work_size)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ static int InitYUVRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
|||||||
|
|
||||||
if (has_alpha) {
|
if (has_alpha) {
|
||||||
if (!WebPRescalerInit(p->scaler_a, io->mb_w, io->mb_h,
|
if (!WebPRescalerInit(p->scaler_a, io->mb_w, io->mb_h,
|
||||||
buf->a, out_width, out_height, buf->a_stride, 1,
|
buf->a, out_width, out_height, buf->a_stride, 1,
|
||||||
work + work_size + 2 * uv_work_size)) {
|
work + work_size + 2 * uv_work_size)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -524,13 +524,13 @@ static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
|||||||
p->scaler_a = has_alpha ? &scalers[3] : NULL;
|
p->scaler_a = has_alpha ? &scalers[3] : NULL;
|
||||||
|
|
||||||
if (!WebPRescalerInit(p->scaler_y, io->mb_w, io->mb_h,
|
if (!WebPRescalerInit(p->scaler_y, io->mb_w, io->mb_h,
|
||||||
tmp + 0 * out_width, out_width, out_height, 0, 1,
|
tmp + 0 * out_width, out_width, out_height, 0, 1,
|
||||||
work + 0 * work_size) ||
|
work + 0 * work_size) ||
|
||||||
!WebPRescalerInit(p->scaler_u, uv_in_width, uv_in_height,
|
!WebPRescalerInit(p->scaler_u, uv_in_width, uv_in_height,
|
||||||
tmp + 1 * out_width, out_width, out_height, 0, 1,
|
tmp + 1 * out_width, out_width, out_height, 0, 1,
|
||||||
work + 1 * work_size) ||
|
work + 1 * work_size) ||
|
||||||
!WebPRescalerInit(p->scaler_v, uv_in_width, uv_in_height,
|
!WebPRescalerInit(p->scaler_v, uv_in_width, uv_in_height,
|
||||||
tmp + 2 * out_width, out_width, out_height, 0, 1,
|
tmp + 2 * out_width, out_width, out_height, 0, 1,
|
||||||
work + 2 * work_size)) {
|
work + 2 * work_size)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -539,7 +539,7 @@ static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
|||||||
|
|
||||||
if (has_alpha) {
|
if (has_alpha) {
|
||||||
if (!WebPRescalerInit(p->scaler_a, io->mb_w, io->mb_h,
|
if (!WebPRescalerInit(p->scaler_a, io->mb_w, io->mb_h,
|
||||||
tmp + 3 * out_width, out_width, out_height, 0, 1,
|
tmp + 3 * out_width, out_width, out_height, 0, 1,
|
||||||
work + 3 * work_size)) {
|
work + 3 * work_size)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -165,15 +165,15 @@ int WebPPictureCrop(WebPPicture* pic,
|
|||||||
// Simple picture rescaler
|
// Simple picture rescaler
|
||||||
|
|
||||||
static int RescalePlane(const uint8_t* src,
|
static int RescalePlane(const uint8_t* src,
|
||||||
int src_width, int src_height, int src_stride,
|
int src_width, int src_height, int src_stride,
|
||||||
uint8_t* dst,
|
uint8_t* dst,
|
||||||
int dst_width, int dst_height, int dst_stride,
|
int dst_width, int dst_height, int dst_stride,
|
||||||
rescaler_t* const work,
|
rescaler_t* const work,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
WebPRescaler rescaler;
|
WebPRescaler rescaler;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
if (!WebPRescalerInit(&rescaler, src_width, src_height,
|
if (!WebPRescalerInit(&rescaler, src_width, src_height,
|
||||||
dst, dst_width, dst_height, dst_stride,
|
dst, dst_width, dst_height, dst_stride,
|
||||||
num_channels, work)) {
|
num_channels, work)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -237,12 +237,12 @@ int WebPPictureRescale(WebPPicture* pic, int width, int height) {
|
|||||||
if (!RescalePlane(pic->y, prev_width, prev_height, pic->y_stride,
|
if (!RescalePlane(pic->y, prev_width, prev_height, pic->y_stride,
|
||||||
tmp.y, width, height, tmp.y_stride, work, 1) ||
|
tmp.y, width, height, tmp.y_stride, work, 1) ||
|
||||||
!RescalePlane(pic->u,
|
!RescalePlane(pic->u,
|
||||||
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
||||||
tmp.u,
|
tmp.u,
|
||||||
HALVE(width), HALVE(height), tmp.uv_stride, work, 1) ||
|
HALVE(width), HALVE(height), tmp.uv_stride, work, 1) ||
|
||||||
!RescalePlane(pic->v,
|
!RescalePlane(pic->v,
|
||||||
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
HALVE(prev_width), HALVE(prev_height), pic->uv_stride,
|
||||||
tmp.v,
|
tmp.v,
|
||||||
HALVE(width), HALVE(height), tmp.uv_stride, work, 1)) {
|
HALVE(width), HALVE(height), tmp.uv_stride, work, 1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -259,8 +259,8 @@ int WebPPictureRescale(WebPPicture* pic, int width, int height) {
|
|||||||
WebPInitAlphaProcessing();
|
WebPInitAlphaProcessing();
|
||||||
AlphaMultiplyARGB(pic, 0);
|
AlphaMultiplyARGB(pic, 0);
|
||||||
if (!RescalePlane((const uint8_t*)pic->argb, prev_width, prev_height,
|
if (!RescalePlane((const uint8_t*)pic->argb, prev_width, prev_height,
|
||||||
pic->argb_stride * 4,
|
pic->argb_stride * 4,
|
||||||
(uint8_t*)tmp.argb, width, height,
|
(uint8_t*)tmp.argb, width, height,
|
||||||
tmp.argb_stride * 4, work, 4)) {
|
tmp.argb_stride * 4, work, 4)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,11 @@ struct WebPRescaler {
|
|||||||
// Initialize a rescaler given scratch area 'work' and dimensions of src & dst.
|
// Initialize a rescaler given scratch area 'work' and dimensions of src & dst.
|
||||||
// Returns false in case of error.
|
// Returns false in case of error.
|
||||||
int WebPRescalerInit(WebPRescaler* const rescaler,
|
int WebPRescalerInit(WebPRescaler* const rescaler,
|
||||||
int src_width, int src_height,
|
int src_width, int src_height,
|
||||||
uint8_t* const dst,
|
uint8_t* const dst,
|
||||||
int dst_width, int dst_height, int dst_stride,
|
int dst_width, int dst_height, int dst_stride,
|
||||||
int num_channels,
|
int num_channels,
|
||||||
rescaler_t* const work);
|
rescaler_t* const work);
|
||||||
|
|
||||||
// If either 'scaled_width' or 'scaled_height' (but not both) is 0 the value
|
// If either 'scaled_width' or 'scaled_height' (but not both) is 0 the value
|
||||||
// will be calculated preserving the aspect ratio, otherwise the values are
|
// will be calculated preserving the aspect ratio, otherwise the values are
|
||||||
|
Loading…
x
Reference in New Issue
Block a user