From: Ian Jackson Subject: Re: [PATCH 1 of 3 V3] tools/libxc: Remus Checkpoint Compression Date: Tue, 18 Oct 2011 19:08:51 +0100 Message-ID: <20125.49331.560646.906231@mariner.uk.xensource.com> References: <47fdd52af616131142ac.1318549672@athos.nss.cs.ubc.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <47fdd52af616131142ac.1318549672@athos.nss.cs.ubc.ca> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "rshriram@cs.ubc.ca" Cc: "brendan@cs.ubc.ca" , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org rshriram@cs.ubc.ca writes ("[PATCH 1 of 3 V3] tools/libxc: Remus Checkpoint Compression"): > + flag = *src & FLAGMASK; > + len = *src & LENMASK; > + pos++; > + src++; > + > + if (flag == RUNFLAG) > + { > + if ((pos + len * sizeof(uint32_t)) > compbuf_size) > + { > + ERROR("Out of bounds exception in compression buffer (d):" > + "read ptr %lu, runlen = %u, bufsize = %lu\n", > + pos, len * sizeof(uint32_t), compbuf_size); > + return -1; > + } > + > + memcpy(&destpage[pagepos], src, len * sizeof(uint32_t)); I think this may have a buffer overrun vulnerability. It seems to me that it can write beyond destpage + XC_PAGE_SIZE. Decompressors are often a source of security vulnerabilities of this kind, so it's important that we look at it closely. > +int xc_compression_uncompress_page(xc_interface *xch, char *compbuf, > + unsigned long compbuf_size, > + unsigned long *compbuf_pos, char *dest) > +{ > + return uncompress_page(xch, dest, compbuf_pos, > + (uint8_t *)compbuf, compbuf_size); > +} What is the purpose of this wrapper function ? All it seems to do is massage the type and order of arguments. Thanks, Ian.