]> git.saurik.com Git - redis.git/commitdiff
safety assert in listTypeNext
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Fri, 4 Jun 2010 09:32:33 +0000 (11:32 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Fri, 4 Jun 2010 09:32:33 +0000 (11:32 +0200)
redis.c

diff --git a/redis.c b/redis.c
index 30f05a6365e731400e6d46563c3ab176b598021f..1882d742430ac4f75503e0ac7d89e509ff501c4b 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -5029,6 +5029,9 @@ static void listTypeReleaseIterator(listTypeIterator *li) {
  * and advances the position of the iterator. Returns 1 when the current
  * entry is in fact an entry, 0 otherwise. */
 static int listTypeNext(listTypeIterator *li, listTypeEntry *entry) {
+    /* Protect from converting when iterating */
+    redisAssert(li->subject->encoding == li->encoding);
+
     entry->li = li;
     if (li->encoding == REDIS_ENCODING_ZIPLIST) {
         entry->zi = li->zi;