Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 369981 - dev-libs/libusb-0.12.X memory corruption
Summary: dev-libs/libusb-0.12.X memory corruption
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-03 23:12 UTC by Nicolas Dufresne
Modified: 2012-08-11 19:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch that fixes the memory corruption (libusb_memset_altsetting_alloc.patch,394 bytes, patch)
2011-06-03 23:13 UTC, Nicolas Dufresne
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Dufresne 2011-06-03 23:12:06 UTC
The legacy libusb produce double free curruption when use with scanimage and hp-firmware. From the libusb bug system, this won't be fixed (legacy version) but a patch exist.

Reproducible: Always

Steps to Reproduce:
1. Run scanimage

Actual Results:  
Double free corruption
Comment 1 Nicolas Dufresne 2011-06-03 23:13:42 UTC
Created attachment 275755 [details, diff]
Patch that fixes the memory corruption

From:
http://www.libusb.org/attachment/ticket/11/libusb_memset_altsetting_alloc.patch
Comment 2 Wormo (RETIRED) gentoo-dev 2011-06-06 05:41:42 UTC
Thanks for pointing out this patch, assigning to maintainer
Comment 3 SpanKY gentoo-dev 2011-11-13 23:25:54 UTC
Comment on attachment 275755 [details, diff]
Patch that fixes the memory corruption

pretty sure this patch is broken.  upstream trac is down, so i can't check that.

i think what you actually want is:
     ifp = interface->altsetting + interface->num_altsetting;
+    memset(ifp, 0, sizeof(*ifp));
     interface->num_altsetting++;

can you test that out with your failing case ?
Comment 4 Peter Stuge 2012-05-28 14:30:18 UTC
It would be great to get feedback on this and if SpanKY's patch is needed as opposed the patch from upstream (the Trac works for a long time now) then I'll update the patch attached to the upstream ticket.