Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2021-12-09 01:35:47 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2021-12-09 01:35:47 +0300
commitbe2213472f825fab3cff61029a78954d6f079296 (patch)
treeacc53f04c855d269684b416f7f0c19eaf923a583 /source/blender/blenlib
parentf32b63ec583ce70081a1998b31470dbb74450a0f (diff)
Fix T93858: Zstd-compressed .blend files from external tools aren't recognized
The issue here was that after the seek table check, the underlying file wasn't rewound to the start, so the code that checks for the BLENDER header immediately reaches EOF and fails. Since Blender always writes files with a seek table, this bug isn't triggered by files saved in Blender itself. However, files compressed in external tools generally don't have a seek table.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/filereader_zstd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/filereader_zstd.c b/source/blender/blenlib/intern/filereader_zstd.c
index 55ce32713d9..5a04f5b11f3 100644
--- a/source/blender/blenlib/intern/filereader_zstd.c
+++ b/source/blender/blenlib/intern/filereader_zstd.c
@@ -331,5 +331,8 @@ FileReader *BLI_filereader_new_zstd(FileReader *base)
}
zstd->reader.close = zstd_close;
+ /* Rewind after the seek table check so that zstd_read starts at the file's start. */
+ zstd->base->seek(zstd->base, 0, SEEK_SET);
+
return (FileReader *)zstd;
}