aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-09-04 14:36:44 +0200
committerGitHub <[email protected]>2018-09-04 14:36:44 +0200
commite3e013e4d8287c6dc8ca3992bd4559744e75f8d2 (patch)
treeaad931b012a6c2ab766e08d8ad081ec3d3836783 /lib
parent8593638d1ab72a26ca85a7ef189bb8b0c2e831e8 (diff)
parent7f2efcc8cb3f104e6e3a53b18ce559842450b780 (diff)
downloadotp-e3e013e4d8287c6dc8ca3992bd4559744e75f8d2.tar.gz
otp-e3e013e4d8287c6dc8ca3992bd4559744e75f8d2.tar.bz2
otp-e3e013e4d8287c6dc8ca3992bd4559744e75f8d2.zip
Merge PR-1929 from dotsimon/erl_compare_ext_lists_bug OTP-15277
Erl compare ext lists bug (ERL-705)
Diffstat (limited to 'lib')
-rw-r--r--lib/erl_interface/src/legacy/erl_marshal.c2
-rw-r--r--lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c
index c18067b9bc..932bba43bf 100644
--- a/lib/erl_interface/src/legacy/erl_marshal.c
+++ b/lib/erl_interface/src/legacy/erl_marshal.c
@@ -1803,7 +1803,7 @@ static int cmp_exe2(unsigned char **e1, unsigned char **e2)
k = 0;
while (1) {
if (k++ == min){
- if (i == j) return 0;
+ if (i == j) return compare_top_ext(e1 , e2);
if (i < j) return -1;
return 1;
}
diff --git a/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c b/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c
index 1e986feacf..04e8ca322e 100644
--- a/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c
+++ b/lib/erl_interface/test/erl_ext_SUITE_data/ext_test.c
@@ -88,6 +88,11 @@ TESTCASE(compare_list) {
// erlang:term_to_binary([0, 1000])
unsigned char term4[] = {131,108,0,0,0,2,97,0,98,0,0,3,232,106};
+ // erlang:term_to_binary([a|b])
+ unsigned char term5a[] = {131,108,0,0,0,1,100,0,1,97,100,0,1,98};
+ // erlang:term_to_binary([a|c])
+ unsigned char term5b[] = {131,108,0,0,0,1,100,0,1,97,100,0,1,99};
+
erl_init(NULL, 0);
start_a = term1;
start_b = term2;
@@ -103,6 +108,13 @@ TESTCASE(compare_list) {
test_compare_ext("lists1", start_a, end_a, start_b, end_b, -1);
+ start_a = term5a;
+ start_b = term5b;
+ end_a = term5a + sizeof(term5a);
+ end_b = term5b + sizeof(term5b);
+
+ test_compare_ext("lists5", start_a, end_a, start_b, end_b, -1);
+
report(1);
}