[Bf-blender-cvs] [9523b1478eb] master: BLI_path: assert passing relative paths to BLI_path_cmp_normalized

Campbell Barton noreply at git.blender.org
Fri Jan 28 05:07:35 CET 2022


Commit: 9523b1478ebc447fc6bd7937eb2d80d9c87bda42
Author: Campbell Barton
Date:   Fri Jan 28 15:02:13 2022 +1100
Branches: master
https://developer.blender.org/rB9523b1478ebc447fc6bd7937eb2d80d9c87bda42

BLI_path: assert passing relative paths to BLI_path_cmp_normalized

Assert when "//" prefixed relative paths are passed to
BLI_path_cmp_normalized as this can't be expanded
and it's possible the paths come from different blend files.

===================================================================

M	source/blender/blenlib/intern/path_util.c

===================================================================

diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 65e8c151e8d..f39797c980c 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1832,6 +1832,8 @@ void BLI_path_slash_native(char *path)
 
 int BLI_path_cmp_normalized(const char *p1, const char *p2)
 {
+  BLI_assert_msg(!BLI_path_is_rel(p1) && !BLI_path_is_rel(p2), "Paths arguments must be absolute");
+
   /* Normalize the paths so we can compare them. */
   char norm_p1[FILE_MAX];
   char norm_p2[FILE_MAX];



More information about the Bf-blender-cvs mailing list