Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE-12:Update
spice
0001-lz-Avoid-buffer-reading-overflow-checking-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-lz-Avoid-buffer-reading-overflow-checking-for-image-.patch of Package spice
From b94b3ca285d81180ed8fdf18f949761e40657b93 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio <fziglio@redhat.com> Date: Fri, 22 Dec 2017 18:43:00 +0000 Subject: [PATCH spice-common 1/2] lz: Avoid buffer reading overflow checking for image type The type of the image is just copied from network without any check and later used for array indexing. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> --- common/lz.c | 3 +++ common/lz_common.h | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) Index: spice-common/common/lz.c =================================================================== --- spice-common.orig/common/lz.c +++ spice-common/common/lz.c @@ -612,6 +612,9 @@ void lz_decode_begin(LzContext *lz, uint } encoder->type = (LzImageType)decode_32(encoder); + if (encoder->type < 0 || encoder->type > LZ_IMAGE_TYPE_MAX) { + encoder->usr->error(encoder->usr, "invalid lz type\n"); + } encoder->width = decode_32(encoder); encoder->height = decode_32(encoder); encoder->stride = decode_32(encoder); Index: spice-common/common/lz_common.h =================================================================== --- spice-common.orig/common/lz_common.h +++ spice-common/common/lz_common.h @@ -51,6 +51,7 @@ typedef enum { #define LZ_IMAGE_TYPE_MASK 0x0f #define LZ_IMAGE_TYPE_LOG 4 // number of bits required for coding the image type +#define LZ_IMAGE_TYPE_MAX LZ_IMAGE_TYPE_A8 /* access to the arrays is based on the image types */ static const int IS_IMAGE_TYPE_PLT[] = {0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}; @@ -58,10 +59,10 @@ static const int IS_IMAGE_TYPE_RGB[] = { static const int PLT_PIXELS_PER_BYTE[] = {0, 8, 8, 2, 2, 1}; static const int RGB_BYTES_PER_PIXEL[] = {0, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 1}; -verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_PLT) == (LZ_IMAGE_TYPE_A8 + 1)); -verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_RGB) == (LZ_IMAGE_TYPE_A8 + 1)); +verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_PLT) == (LZ_IMAGE_TYPE_MAX + 1)); +verify(SPICE_N_ELEMENTS(IS_IMAGE_TYPE_RGB) == (LZ_IMAGE_TYPE_MAX + 1)); verify(SPICE_N_ELEMENTS(PLT_PIXELS_PER_BYTE) == (LZ_IMAGE_TYPE_PLT8 + 1)); -verify(SPICE_N_ELEMENTS(RGB_BYTES_PER_PIXEL) == (LZ_IMAGE_TYPE_A8 + 1)); +verify(SPICE_N_ELEMENTS(RGB_BYTES_PER_PIXEL) == (LZ_IMAGE_TYPE_MAX + 1)); #define LZ_MAGIC (*(uint32_t *)"LZ ") #define LZ_VERSION_MAJOR 1U
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