From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6gVi-0002Ft-F0 for qemu-devel@nongnu.org; Wed, 09 Dec 2015 10:18:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6gVf-0005nA-Ab for qemu-devel@nongnu.org; Wed, 09 Dec 2015 10:18:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6gVf-0005m7-4u for qemu-devel@nongnu.org; Wed, 09 Dec 2015 10:18:27 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id D201F13595 for ; Wed, 9 Dec 2015 15:18:25 +0000 (UTC) References: <1448641837-1632-1-git-send-email-berrange@redhat.com> <1448641837-1632-2-git-send-email-berrange@redhat.com> <566702D6.7000201@redhat.com> <20151209125036.GD19914@redhat.com> From: Eric Blake Message-ID: <5668463C.8030800@redhat.com> Date: Wed, 9 Dec 2015 08:18:20 -0700 MIME-Version: 1.0 In-Reply-To: <20151209125036.GD19914@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kl2GXg1kIbKeWKiGA2ilqRA9DCVhposgc" Subject: Re: [Qemu-devel] [PATCH v3 1/5] util: add base64 decoding function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kl2GXg1kIbKeWKiGA2ilqRA9DCVhposgc Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 >>> --- >> >>> + uint8_t *actual =3D qbase64_decode(input, >>> + input_len, >>> + &len, >>> + &err); >>> + >>> + g_assert(err !=3D NULL); >> >> Could use &error_abort in the original call instead of a second check >> for err !=3D NULL; but that's cosmetic. >=20 > 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 =3D=3D NULL). (Which is why I ten= d to just do g_assert(err) or g_assert(!err) instead of having to think about the comparison with NULL, oh well). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --kl2GXg1kIbKeWKiGA2ilqRA9DCVhposgc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWaEY8AAoJEKeha0olJ0NqYgwH/iYPnscM37xrjGFH5RWnUAVy YvEsnB0FmxzQAlgeyxGJ1XclHe4p1HZOHXfT0A5Akfj9hEuyT9005PTglmK9pehz hTBltjxJlsFcZ50GAH2rkqXWtcoIobjlM4QqarwN9mSlWeTQCvOinPmRc/m5FLis uWcepdH17id+r9bg1VOJulVPQn++Gi4tUmfRbzDqif1M9V/UeU86lu7SuS+9nIr/ ntZpH9JKAOQ/CGcjxqJXhtHo+5XE4GCxH5L3kOsm2DxULhYxZiqrHdk7QCdaz8Tn MCsmtg+Jjd6XIJ9A76mJ7VSNC++bzQutDkBLeO+8xOpbgUnHHrTQ69riaV2mv7o= =pFD0 -----END PGP SIGNATURE----- --kl2GXg1kIbKeWKiGA2ilqRA9DCVhposgc--