lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [2/6] lucy-clownfish git commit: Avoid potential overflow in VA_Excise
Date Sun, 26 Apr 2015 09:51:31 GMT
Avoid potential overflow in VA_Excise


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/ed096ff4
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/ed096ff4
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/ed096ff4

Branch: refs/heads/master
Commit: ed096ff47a3d92eb06a2204b8352043a32c5fc58
Parents: 2db62be
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Thu Apr 23 14:33:51 2015 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Thu Apr 23 14:33:51 2015 +0200

----------------------------------------------------------------------
 runtime/core/Clownfish/VArray.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ed096ff4/runtime/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/VArray.c b/runtime/core/Clownfish/VArray.c
index f395c6d..294e342 100644
--- a/runtime/core/Clownfish/VArray.c
+++ b/runtime/core/Clownfish/VArray.c
@@ -199,8 +199,8 @@ VA_Delete_IMP(VArray *self, size_t num) {
 
 void
 VA_Excise_IMP(VArray *self, size_t offset, size_t length) {
-    if (self->size <= offset)              { return; }
-    else if (self->size < offset + length) { length = self->size - offset; }
+    if (offset >= self->size)         { return; }
+    if (length > self->size - offset) { length = self->size - offset; }
 
     for (size_t i = 0; i < length; i++) {
         DECREF(self->elems[offset + i]);


Mime
View raw message