From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqFPM-00034V-Al for qemu-devel@nongnu.org; Mon, 09 Dec 2013 23:59:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqFPE-0003LY-LP for qemu-devel@nongnu.org; Mon, 09 Dec 2013 23:58:56 -0500 Message-ID: <52A69F85.10600@redhat.com> Date: Tue, 10 Dec 2013 05:58:45 +0100 From: Laszlo Ersek MIME-Version: 1.0 References: <1385658779-7529-1-git-send-email-lersek@redhat.com> <87eh6074ye.fsf@blackfin.pond.sub.org> In-Reply-To: <87eh6074ye.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu_opts_parse(): always check return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-stable@nongnu.org Cc: Markus Armbruster On 11/28/13 19:32, Markus Armbruster wrote: > Laszlo Ersek writes: > >> qemu_opts_parse() can always return NULL, even if the QemuOptsList.desc in >> question would be trivial to satisfy (eg. because it's empty). For >> example: >> >> qemu_opts_parse() >> opts_parse() >> qemu_opts_create() >> id_wellformed() >> >> In practice: >> >> $ .../qemu-system-x86_64 -acpitable id=3 >> qemu-system-x86_64: -acpitable id=3: Parameter 'id' expects an identifier >> ** >> ERROR:vl.c:3491:main: assertion failed: (opts != NULL) >> Aborted (core dumped) >> >> $ .../qemu-system-x86_64 -smbios id=3 >> qemu-system-x86_64: -smbios id=3: Parameter 'id' expects an identifier >> Segmentation fault (core dumped) >> >> I checked all qemu_opts_parse() invocations (and all drive_def() >> invocations too, because it blindly forwards the former's retval). Only >> the two above examples look problematic. >> >> Signed-off-by: Laszlo Ersek > > Your fix is fine. I didn't redo your search for other unsafe uses. > > Reviewed-by: Markus Armbruster > Ping -- please commit this. Thanks Laszlo