From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 317 invoked by alias); 5 Jun 2014 12:51:04 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 302 invoked by uid 89); 5 Jun 2014 12:51:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: hera.aquilenet.fr Received: from hera.aquilenet.fr (HELO hera.aquilenet.fr) (141.255.128.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jun 2014 12:51:01 +0000 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id B859D2ACE; Thu, 5 Jun 2014 14:50:58 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XAovw5E3qElE; Thu, 5 Jun 2014 14:50:58 +0200 (CEST) Received: from pluto (pluto.bordeaux.inria.fr [193.50.110.57]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7EDB02886; Thu, 5 Jun 2014 14:50:58 +0200 (CEST) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: gdb@sourceware.org, Doug Evans Subject: [PATCH] guile: Type-check the argument to 'history-append!' X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 17 Prairial an 222 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Thu, 05 Jun 2014 12:51:00 -0000 Message-ID: <87vbsfv7t9.fsf@gnu.org> User-Agent: Gnus/5.130009 (Ma Gnus v0.9) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2014-06/txt/msg00020.txt.bz2 The patch below add a missing type check in =E2=80=98history-append!=E2=80= =99 (I=E2=80=99m guilty.) OK to push? Ludo=E2=80=99. gdb/ 2014-06-05 Ludovic Court=C3=A8s * guile/scm-value.c (gdbscm_history_append_x): Use 'vlscm_get_value_smob_arg_unsafe' instead of 'vlscm_scm_to_value'. gdb/testsuite/ 2014-06-05 Ludovic Court=C3=A8s * gdb.guile/scm-value.exp (test_value_in_inferior): Add test "history-append! type error". diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 8e579a4..0ae8103 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -1295,9 +1295,11 @@ gdbscm_history_append_x (SCM value) { int res_index =3D -1; struct value *v; + value_smob *v_smob; volatile struct gdb_exception except; =20 - v =3D vlscm_scm_to_value (value); + v_smob =3D vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME); + v =3D v_smob->value; =20 TRY_CATCH (except, RETURN_MASK_ALL) { diff --git a/gdb/testsuite/gdb.guile/scm-value.exp b/gdb/testsuite/gdb.guil= e/scm-value.exp index 2784da2..425873e 100644 --- a/gdb/testsuite/gdb.guile/scm-value.exp +++ b/gdb/testsuite/gdb.guile/scm-value.exp @@ -71,6 +71,10 @@ proc test_value_in_inferior {} { gdb_test_no_output "guile (gc)" gdb_test "p \$\$" "=3D 42" =20 + # Make sure 'history-append!' rejects non-value objects. + gdb_test "gu (history-append! 123)" \ + "ERROR:.* Wrong type argument.*" "history-append! type error" + # Test dereferencing the argv pointer. =20 # Just get inferior variable argv the value history, available to guil= e.