- According to some duplicates, this crash is 100% reproducible with some devices (unfortunately with none of mine)
- stdout is not NULL (the -O2 optimized that away unfortunately, but the condition is checked before)
- devkit-disks-helper-ata-smart-collect returned with exit code 0 (condition is checked before)
- blob_size could be already written by g_base64_decode(), or just be uninitialized, so we can't rely on the origin of "1"
- g_base64_decode() code shows that it can only return NULL in those conditions:
Some analysis:
- According to some duplicates, this crash is 100% reproducible with some devices (unfortunately with none of mine) disks-helper- ata-smart- collect returned with exit code 0 (condition is checked before)
- stdout is not NULL (the -O2 optimized that away unfortunately, but the condition is checked before)
- devkit-
- blob_size could be already written by g_base64_decode(), or just be uninitialized, so we can't rely on the origin of "1"
- g_base64_decode() code shows that it can only return NULL in those conditions:
g_return_ val_if_ fail (text != NULL, NULL); val_if_ fail (out_len != NULL, NULL);
g_return_
input_length = strlen (text);
g_return_ val_if_ fail (input_length > 1, NULL);
We already know that text != NULL (which is "stdout" here), and we also know that out_len != NULL (it's a pointer to a local variable.
So it seems that the reason is that stdout is just a single character.
I propose to intercept this condition gracefully and add some debug logging what the output is, so that in the future we can get to the root cause.