Skip to content

Commit 6628ea7

Browse files
committed
gh-127740: Check if we had a second digit
1 parent 82762db commit 6628ea7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,8 +2543,8 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
25432543

25442544
bot = _PyLong_DigitValue[*str];
25452545
if (bot >= 16) {
2546-
/* NULL at the end of the string */
2547-
if (bot == 37){
2546+
/* Check if we had a second digit */
2547+
if (str >= end){
25482548
invalid_char = -1;
25492549
} else {
25502550
invalid_char = str - PyUnicode_1BYTE_DATA(string);

0 commit comments

Comments
 (0)