I have a problem with libusb_interrupt_transfer under cygwin. When I want to 
read data from a USB device and there is nothing to receive, I get a 
Segmentation fault. I managed to backtrace the fault to 
hid_copy_transfer_data() in windows_usb.c, line: 
memcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer+1, corrected_size); 

The problem starts in windows_usb.c from windows_handle_events() where 
GetOverlappedResult(transfer_priv->pollable_fd.handle, 
transfer_priv->pollable_fd.overlapped, &io_size, false) sets io_size to 0 and 
io_result = ERROR_OPERATION_ABORTED. Because of io_result value, the program 
will call function hid_copy_transfer_data() from windows_transfer_callback() 
with io_size = 0. 
In hid_copy_transfer_data() we have a problem then :
uint32_t corrected_size = io_size; (value is 0).
corrected_size--;
memcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer+1, corrected_size);



---
Reply to this email directly or view it on GitHub:
https://github.com/libusbx/libusbx/issues/160
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to