Commit c6f9ad7
committed
patch_parse: fix undefined behaviour due to arithmetic on NULL pointers
Doing arithmetic with NULL pointers is undefined behaviour in the C
standard. We do so regardless when parsing patches, as we happily add a
potential prefix length to prefixed paths. While this works out just
fine as the prefix length is always equal to zero in these cases, thus
resulting in another NULL pointer, it still is undefined behaviour and
was pointed out to us by OSSfuzz.
Fix the issue by checking whether paths are NULL, avoiding the
arithmetic if they are.1 parent 3e6a904 commit c6f9ad7
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
1028 | | - | |
| 1028 | + | |
1029 | 1029 | | |
| 1030 | + | |
| 1031 | + | |
1030 | 1032 | | |
1031 | 1033 | | |
1032 | 1034 | | |
1033 | | - | |
| 1035 | + | |
1034 | 1036 | | |
| 1037 | + | |
| 1038 | + | |
1035 | 1039 | | |
1036 | 1040 | | |
1037 | 1041 | | |
| |||
0 commit comments