Better sanity check handling WordITerator, position list decode 4

Chris Pollett [2023-09-01 16:Sep:st]
Better sanity check handling WordITerator, position list decode 4
Filename
src/library/index_bundle_iterators/WordIterator.php
diff --git a/src/library/index_bundle_iterators/WordIterator.php b/src/library/index_bundle_iterators/WordIterator.php
index 05b4c2904..f3bee8444 100644
--- a/src/library/index_bundle_iterators/WordIterator.php
+++ b/src/library/index_bundle_iterators/WordIterator.php
@@ -497,8 +497,8 @@ class WordIterator extends IndexBundleIterator
             max($this->total_num_docs, 1);
         foreach ($postings as $posting) {
             $posting[self::GENERATION] = $partition;
-            if ($posting['POSITIONS_LEN'] > 0 && $file_size < $posting['POSITIONS_LEN']
-                && !empty($fh)) {
+            if ($posting['POSITIONS_LEN'] > 0 && $posting['POSITIONS_LEN'] <
+                $file_size && !empty($fh)) {
                 if (fseek($fh, $posting['POSITIONS_OFFSET']) >= 0) {
                     $encoded_positions = fread($fh, $posting['POSITIONS_LEN']);
                     $posting[self::POSITION_LIST] = L\decodePositionList(
ViewGit