]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed wrong assert condition
authorYann Collet <cyan@fb.com>
Wed, 3 Mar 2021 23:30:55 +0000 (15:30 -0800)
committerYann Collet <cyan@fb.com>
Wed, 3 Mar 2021 23:30:55 +0000 (15:30 -0800)
contrib/seekable_format/zstdseek_decompress.c

index 71d70c024d690f01ce09cd68524d7bb7cd045e9e..748e76a3f6afce96766c68f578faab99245b39af 100644 (file)
@@ -120,16 +120,16 @@ static int ZSTD_seekable_seek_buff(void* opaque, long long offset, int origin)
     buffWrapper_t* const buff = (buffWrapper_t*) opaque;
     unsigned long long newOffset;
     assert(buff != NULL);
-    assert(offset >= 0);
     switch (origin) {
     case SEEK_SET:
+        assert(offset >= 0);
         newOffset = (unsigned long long)offset;
         break;
     case SEEK_CUR:
-        newOffset = (unsigned long long)buff->pos + (unsigned long long)offset;
+        newOffset = (unsigned long long)((long long)buff->pos + offset);
         break;
     case SEEK_END:
-        newOffset = (unsigned long long)buff->size + (unsigned long long)offset;
+        newOffset = (unsigned long long)((long long)buff->size + offset);
         break;
     default:
         assert(0);  /* not possible */