On 12/09/2015 05:50 AM, Daniel P. Berrange wrote:
> On Tue, Dec 08, 2015 at 09:18:30AM -0700, Eric Blake wrote:
>> On 11/27/2015 09:30 AM, Daniel P. Berrange wrote:
>>> The standard glib provided g_base64_decode doesn't provide any
>>> kind of sensible error checking on its input. Add a QEMU custom
>>> wrapper qbase64_decode which can be used with untrustworthy
>>> input that can contain invalid base64 characters, embedded
>>> NUL characters, or not be NUL terminated at all.
>>>
>>> Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
>>> ---
>>

>>> +    uint8_t *actual = qbase64_decode(input,
>>> +                                     input_len,
>>> +                                     &len,
>>> +                                     &err);
>>> +
>>> +    g_assert(err != NULL);
>>
>> Could use &error_abort in the original call instead of a second check
>> for err != NULL; but that's cosmetic.
> 
> Actually we can't use &error_abort, as we don't want the test
> function to abort on error as that would indicate test failure.
> We want to make sure the call completes & returns an error
> set without aborting.

Whoops; confusing it with g_assert(err == NULL).  (Which is why I tend
to just do g_assert(err) or g_assert(!err) instead of having to think
about the comparison with NULL, oh well).

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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to