Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
spice-gtk
0002-quic-Check-image-size-in-quic_decode_begin...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-quic-Check-image-size-in-quic_decode_begin.patch of Package spice-gtk
From e99663d6a26944450cd522f2dfacf63b59777efe Mon Sep 17 00:00:00 2001 From: Frediano Ziglio <freddy77@gmail.com> Date: Wed, 29 Apr 2020 15:10:24 +0100 Subject: [PATCH 2/4] quic: Check image size in quic_decode_begin Avoid some overflow in code due to images too big or negative numbers. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com> Signed-off-by: Bruce Rogers <brogers@suse.com> --- common/quic.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spice-common/common/quic.c b/spice-common/common/quic.c index a7dfc86..4e9caf9 100644 --- a/spice-common/common/quic.c +++ b/spice-common/common/quic.c @@ -59,6 +59,9 @@ typedef uint8_t BYTE; #define MINwminext 1 #define MAXwminext 100000000 +/* Maximum image size in pixels, mainly to avoid possible integer overflows */ +#define SPICE_MAX_IMAGE_SIZE (512 * 1024 * 1024 - 1) + typedef struct QuicFamily { unsigned int nGRcodewords[MAXNUMCODES]; /* indexed by code number, contains number of unmodified GR codewords in the code */ @@ -1176,6 +1179,16 @@ int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_w height = encoder->io_word; decode_eat32bits(encoder); + if (width <= 0 || height <= 0) { + encoder->usr->warn(encoder->usr, "invalid size\n"); + return QUIC_ERROR; + } + + /* avoid too big images */ + if ((uint64_t) width * height > SPICE_MAX_IMAGE_SIZE) { + encoder->usr->error(encoder->usr, "image too large\n"); + } + quic_image_params(encoder, type, &channels, &bpc); if (!encoder_reste_channels(encoder, channels, width, bpc)) { -- 2.28.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor