Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE-12:Update
spice
0007-Prevent-32-bit-integer-overflow-in-bitmap_...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0007-Prevent-32-bit-integer-overflow-in-bitmap_consistent.patch of Package spice
From 0f58e9da56e0cbbe4349eefcbb300b6f285e0423 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio <fziglio@redhat.com> Date: Tue, 8 Sep 2015 13:09:35 +0100 Subject: [PATCH 07/19] Prevent 32 bit integer overflow in bitmap_consistent The overflow may lead to buffer overflow as the row size computed from width (bitmap->x) can be bigger than the size in bytes (bitmap->stride). This can make spice-server accept the invalid sizes. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com> --- server/red_parse_qxl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Index: spice-0.12.4/server/red_parse_qxl.c =================================================================== --- spice-0.12.4.orig/server/red_parse_qxl.c +++ spice-0.12.4/server/red_parse_qxl.c @@ -357,11 +357,12 @@ static const char *bitmap_format_to_stri return "unknown"; } -static const int MAP_BITMAP_FMT_TO_BITS_PER_PIXEL[] = {0, 1, 1, 4, 4, 8, 16, 24, 32, 32, 8}; +static const unsigned int MAP_BITMAP_FMT_TO_BITS_PER_PIXEL[] = + {0, 1, 1, 4, 4, 8, 16, 24, 32, 32, 8}; static int bitmap_consistent(SpiceBitmap *bitmap) { - int bpp; + unsigned int bpp; if (bitmap->format >= SPICE_N_ELEMENTS(MAP_BITMAP_FMT_TO_BITS_PER_PIXEL)) { spice_warning("wrong format specified for image\n"); @@ -370,7 +371,7 @@ static int bitmap_consistent(SpiceBitmap bpp = MAP_BITMAP_FMT_TO_BITS_PER_PIXEL[bitmap->format]; - if (bitmap->stride < ((bitmap->x * bpp + 7) / 8)) { + if (bitmap->stride < (((uint64_t) bitmap->x * bpp + 7u) / 8u)) { spice_error("image stride too small for width: %d < ((%d * %d + 7) / 8) (%s=%d)\n", bitmap->stride, bitmap->x, bpp, bitmap_format_to_string(bitmap->format),
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