You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Helper function, so that this isn't duplicated in hid_read(). */
static int return_data(hid_device *dev, unsigned char *data, size_t length)
{
/* Copy the data out of the linked list item (rpt) into the
return buffer (data), and delete the liked list item. */
struct input_report *rpt = dev->input_reports;
size_t len = (length < rpt->len)? length: rpt->len;
memcpy(data, rpt->data, len); <------- HERE rpt->data = [0,0,0,0,0,0,.....0,0]
/* The Run Loop calls this function for each input report received.
This function puts the data into a linked list to be picked up by
hid_read(). */
static void hid_report_callback(void *context, IOReturn result, void *sender,
IOHIDReportType report_type, uint32_t report_id,
uint8_t *report, CFIndex report_length)
{
struct input_report *rpt;
hid_device *dev = context;
/* Make a new Input Report object */
rpt = calloc(1, sizeof(struct input_report));
rpt->data = calloc(1, report_length);
memcpy(rpt->data, report, report_length); <-----
The contents of rpt->data are all 0x00 at the source as well
Is it an OSX Bug? Why only on signature returns? Why do all other APDUs work without issue?
Affects Big Sur (OS X 11) and Monterey (OS X 12)
Maybe it's a ledger-cosmos bug? But why does this APDU only fail on CLI and not Keplr (Browser extension)?
Maybe it's a NanoX+Cosmos Bug+CLI Bug? NanoSPlus doesn't experience this problem very often. Faster processor?
On a Mac M1(and x64), especially with Ledger Nano X:
The function call at line 216: https://github.com/Zondax/hid/blob/master/hid_enabled.go#L216
Sometimes returns read == 64, and a zero filled buffer
C.hid_read [64] => [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
This is most commonly seen during a sign request : INS_GET_ADDR_SECP256K1
Where:
This error occurs "randomly" from time to time.
We can also share that at this point of the program:
https://github.com/Zondax/hid/blob/master/hidapi/mac/hid.c#L802
The contents of rpt->data are all 0x00
Checking the event source:
hid_report_callback
https://github.com/Zondax/hid/blob/master/hidapi/mac/hid.c#L566
The contents of rpt->data are all 0x00 at the source as well
Is it an OSX Bug? Why only on signature returns? Why do all other APDUs work without issue?
Maybe it's a ledger-cosmos bug? But why does this APDU only fail on CLI and not Keplr (Browser extension)?
Maybe it's a NanoX+Cosmos Bug+CLI Bug? NanoSPlus doesn't experience this problem very often. Faster processor?
NanoX ledger-cosmos v2.34.3
NanoSPlus ledger-cosmos v2.34.3
This affects cosmos-sdk cli applications as documented here:
cosmos/ledger-cosmos#57
The text was updated successfully, but these errors were encountered: