1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix type-checking in the optimized path of `string=?'.

* libguile/srfi-13.c (scm_string_eq): Properly type-check S1 and S2.

* test-suite/tests/strings.test ("string=?")["1st argument EOF", "2nd
  argument EOF"]: New tests exposing the problem.
This commit is contained in:
Ludovic Courtès 2010-07-12 17:31:38 +02:00
parent 0803914395
commit 7614c983a5
2 changed files with 12 additions and 3 deletions

View file

@ -1168,7 +1168,8 @@ SCM_DEFINE (scm_string_eq, "string=", 2, 4, 0,
"value otherwise.")
#define FUNC_NAME s_scm_string_eq
{
if (SCM_LIKELY (scm_i_is_narrow_string (s1) == scm_i_is_narrow_string (s2)
if (SCM_LIKELY (scm_is_string (s1) && scm_is_string (s2) &&
scm_i_is_narrow_string (s1) == scm_i_is_narrow_string (s2)
&& SCM_UNBNDP (start1) && SCM_UNBNDP (end1)
&& SCM_UNBNDP (start2) && SCM_UNBNDP (end2)))
{