]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-131296: Avoid invalid signed char comparison in getpath.c assertion (GH-131594)
authorChris Eibl <138194463+chris-eibl@users.noreply.github.com>
Tue, 22 Apr 2025 13:06:30 +0000 (15:06 +0200)
committerGitHub <noreply@github.com>
Tue, 22 Apr 2025 13:06:30 +0000 (14:06 +0100)
Modules/getpath.c

index e2478da021f51194c9aa58a0b42a560ecf94547b..1e75993480ae363b99bb0f7b3e41866c237f647e 100644 (file)
@@ -690,7 +690,7 @@ env_to_dict(PyObject *dict, const char *key, int and_clear)
     // Quick convert to wchar_t, since we know key is ASCII
     wchar_t *wp = wkey;
     for (const char *p = &key[4]; *p; ++p) {
-        assert(*p < 128);
+        assert(!(*p & 0x80));
         *wp++ = *p;
     }
     *wp = L'\0';