From 49a4808a2262926b866207094000763d89758742 Mon Sep 17 00:00:00 2001 From: "Sunrim KIM (keen)" <3han5chou7@gmail.com> Date: Wed, 28 May 2014 02:55:19 +0900 Subject: [PATCH] check length before compare contents --- src/bool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bool.c b/src/bool.c index ef497362..904a21d6 100644 --- a/src/bool.c +++ b/src/bool.c @@ -28,6 +28,9 @@ pic_equal_p(pic_state *pic, pic_value x, pic_value y) case PIC_TT_BLOB: { int i; struct pic_blob *v1 = pic_blob_ptr(x), *v2 = pic_blob_ptr(y); + if(v1->len != v2->len){ + return false; + } for(i = 0; i < v1->len; ++i){ if(v1->data[i] != v2->data[i]) return false; @@ -38,6 +41,9 @@ pic_equal_p(pic_state *pic, pic_value x, pic_value y) size_t i; struct pic_vector *v1 = pic_vec_ptr(x), *v2 = pic_vec_ptr(y); + if(v1->len != v2->len){ + return false; + } for(i = 0; i < v1->len; ++i){ if(! pic_equal_p(pic, v1->data[i], v2->data[i])) return false;