From: Ian Jackson Subject: Re: [PATCH 18/21] libxc: Add range checking to xc_dom_binloader Date: Fri, 7 Jun 2013 15:53:34 +0100 Message-ID: <20913.62446.171676.894874@mariner.uk.xensource.com> References: <1370544726-30459-1-git-send-email-ian.jackson@eu.citrix.com> <1370544726-30459-19-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Matthew Daley Cc: andrew.cooper3@citrix.com, xen-devel@lists.xensource.com, Ian Jackson , security@xen.org List-Id: xen-devel@lists.xenproject.org Matthew Daley writes ("Re: [PATCH 18/21] libxc: Add range checking to xc_dom_binloader"): > On Fri, Jun 7, 2013 at 6:52 AM, Ian Jackson wrote: > > This is a simple binary image loader with its own metadata format. > > However, it is too careless with image-supplied values. > > > > Add the following checks: > > > > * That the image is bigger than the metadata table; otherwise the > > pointer arithmetic to calculate the metadata table location may > > yield undefined and dangerous values. > > > > * When clamping the end of the region to search, that we do not > > calculate pointers before the beginning of the image. > > Don't you mean after the end of the image? I can't reconcile this bit > with the actual patch. You're right. > > + if ( image_size < skip || > > + image_size - skip < text_size ) > > + { > > + DOMPRINTF("%s: image is too small for declared text size", > > + __FUNCTION__); > > return -EINVAL (or similar) is needed here. Oops. Ian.