[erlang-bugs] erl_compare_ext fails to compare tuples properly
Paul Mineiro
paul-trapexit@REDACTED
Tue Jun 3 06:57:50 CEST 2008
the attached patch (which fixes the problem) is pretty clear, but i also
attached a C program which demonstrates the problem just in case.
-- p
In an artificial world, only extremists live naturally.
-- Paul Graham
-------------- next part --------------
--- /usr/lib/erlang/lib/erl_interface-3.5.5.3/src/legacy/erl_marshal.c 2007-08-05 08:48:58.000000000 -0700
+++ erl_marshal.c 2008-06-02 20:20:10.000000000 -0700
@@ -1502,7 +1502,7 @@
case ERL_SMALL_TUPLE_EXT:
i = *(*e1)++; j = *(*e2)++;
if (i < j) return -1;
- if (j > j ) return 1;
+ if (i > j) return 1;
while (i--) {
if ((j = compare_top_ext(e1, e2))) return j;
}
@@ -1513,7 +1513,7 @@
j = (**e2 << 24) | ((*e2)[1]) << 16| ((*e2)[2]) << 8| ((*e2)[3]) ;
*e2 += 4;
if (i < j) return -1;
- if (j > j ) return 1;
+ if (i > j) return 1;
while (i--) {
if ((j = compare_top_ext(e1, e2))) return j;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: erl_compare_ext_bug.tgz
Type: application/x-gtar
Size: 9337 bytes
Desc:
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080602/a07fa178/attachment.gtar>
More information about the erlang-bugs
mailing list