Re: [PATCH] S390: Fix virSysinfoRead memory corruption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/07/2012 01:44 AM, Viktor Mihajlovski wrote:
> There was a double free issue caused by virSysinfoRead on s390,
> as the same manufacturer string instance was assigned to more
> than one processor record.
> Cleaned up other potential memory issues and restructured the sysinfo
> parsing code by moving repeating patterns into a helper function.
> 
> BTW: I hit an issue with using strchr(string,variable), as I am
> still compiling with gcc 4.4.x, see
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513

I seem to recall that we've hit this before.

/me searches

Yep - src/util/buf.c contains this gem:

    while (*cur != 0) {
        /* strchr work-around for gcc 4.3 & 4.4 bug with -Wlogical-op
         * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513
         */
        char needle[2] = { *cur, 0 };
        if (strstr(toescape, needle))
            *out++ = escape;
        *out++ = *cur;
        cur++;
    }


> I circumvented this using index(), which is deprecated, but working.

No.  Don't use index(), as it is not guaranteed to exist.

What we should _really_ do is provide a change in
m4/virt-compile-warnings.m4 that disables -Wlogical-op if compiling with
a broken gcc, now that newer gcc doesn't force its stupidity on a
sensible strchr() usage.  I'll attempt that patch independently, and
then your patch can go on top using strchr() from the get-go.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]