We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6cc9305 commit c34696eCopy full SHA for c34696e
Objects/bytesobject.c
@@ -2540,16 +2540,14 @@ _PyBytes_FromHex(PyObject *string, int use_bytearray)
2540
goto error;
2541
}
2542
str++;
2543
-
2544
- /* Check if we have a second digit */
2545
- if (str >= end) {
2546
- invalid_char = -1;
2547
- goto error;
2548
- }
2549
2550
bot = _PyLong_DigitValue[*str];
2551
if (bot >= 16) {
2552
- invalid_char = str - PyUnicode_1BYTE_DATA(string);
+ /* NULL at the end of the string */
+ if (bot == 37){
+ invalid_char = -1;
+ } else {
+ invalid_char = str - PyUnicode_1BYTE_DATA(string);
+ }
2553
2554
2555
0 commit comments