Mesa (staging/21.1): util/fossilize_db: Reset file position to parsed_offset on cache_offset read failure.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 9 07:32:38 UTC 2021


Module: Mesa
Branch: staging/21.1
Commit: f5327d5407abb380c534afb80e553f3e1624b1da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5327d5407abb380c534afb80e553f3e1624b1da

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Thu Aug  5 03:03:48 2021 +0200

util/fossilize_db: Reset file position to parsed_offset on cache_offset read failure.

Otherwise we might restart reading from the middle of the entry.

Fixes: 2ec1bff0f3a "util/fossilize_db: Split out reading the index."
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12204>
(cherry picked from commit 57ca07455ce03006aa4f6b66a5b0fe67570a1593)

---

 .pick_status.json       | 2 +-
 src/util/fossilize_db.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 67bf9c4e6d6..c69bf4f51b6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -193,7 +193,7 @@
         "description": "util/fossilize_db: Reset file position to parsed_offset on cache_offset read failure.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "2ec1bff0f3a4450a9739d59421dc9c9fe72c94c6"
     },
diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c
index aefc461ebb2..8b80d13403d 100644
--- a/src/util/fossilize_db.c
+++ b/src/util/fossilize_db.c
@@ -157,7 +157,7 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx)
       uint64_t cache_offset;
       if (fread(&cache_offset, 1, sizeof(cache_offset), db_idx) !=
           sizeof(cache_offset))
-         return;
+         break;
 
       entry->offset = cache_offset;
 



More information about the mesa-commit mailing list