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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 7 20:40:22 UTC 2021


Module: Mesa
Branch: main
Commit: 57ca07455ce03006aa4f6b66a5b0fe67570a1593
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=57ca07455ce03006aa4f6b66a5b0fe67570a1593

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>

---

 src/util/fossilize_db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c
index 8a380812425..6737cf2b21b 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