WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] possible bug on libxc ? on amd64

To: Enrico Maniciati <enrico.maniciati@xxxxxxxxxxx>
Subject: Re: [Xen-devel] possible bug on libxc ? on amd64
From: Daniel Stodden <stodden@xxxxxxxxxx>
Date: Sun, 02 Dec 2007 00:45:39 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 01 Dec 2007 15:46:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <!&!AAAAAAAAAAAYAAAAAAAAAMLCSiRqEnZJpPWJJ3g0bWHCgAAAEAAAAHiW7Hm1yspMlLmdWGdk+iIBAAAAAA==@xxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Fakultät für Informatik I10, Technische Universität Münche
References: <!&!AAAAAAAAAAAYAAAAAAAAAMLCSiRqEnZJpPWJJ3g0bWHCgAAAEAAAAHiW7Hm1yspMlLmdWGdk+iIBAAAAAA==@xxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Sat, 2007-12-01 at 16:25 +0100, Enrico Maniciati wrote:

> In function  :

> xc_core_shdr_get(struct xc_core_section_headers *sheaders) {

>     if ( sheaders->num == sheaders->num_max )
>     {
>         Elf64_Shdr *shdrs;
>         if ( sheaders->num_max + SHDR_INC < sheaders->num_max )  <---
> in this point 

sorry, good point, but this is a test against integer wrap.

>        {
>             errno = E2BIG;
>             return NULL;
>         }
>         sheaders->num_max += SHDR_INC;

num max is a 16bit integer, SHDR_INC is def'd to 4.
the function allocates up to 65532 entries, then num_max wraps to zero
and it reports failure. it's probably okay like this.

>         shdrs = realloc(sheaders->shdrs,
>                         sizeof(sheaders->shdrs[0]) *
> sheaders->num_max);

>         if ( shdrs == NULL ) <<-- word wrap ??

no, this means out of memory.

> i think this are correct: 

[...]

quite frankly, with the exception of variants in bracing and indentation
i don't see the difference.

> Always happy c++

> C++ are always better than other J 

thanks for all the hints. 

a tip in return: check out the 'diff' command (supposed you've got
cygwin or similar installed). works approximately like this:

        $ cp xc_core.c xc_core.c.orig
        /* .. edit xc_core.c */
        $ diff xc_core.c.orig xc_core.c > xc_core.c.diff

the resulting .diff-file is what best suited to send to mailing lists in
order to suggest buf fixes or improvement to source code.

thanks and regards,
daniel


-- 
Daniel Stodden
LRR     -      Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München             D-85748 Garching
http://www.lrr.in.tum.de/~stodden         mailto:stodden@xxxxxxxxxx
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33  3D80 457E 82AE B0D8 735B



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>