Repository navigation
Commit e13019b
committed
Fix: UNINIT.LOCAL_VAR
Problem:
Argument Clinic rendered the adjacent "length" variable of an optional
length-bearing string parameter ("s#", "y#", "z#", "u#", "Z#") without an
initializer. The parser only writes *<name>_length when the argument is
actually passed, so an omitted argument left the variable undefined and the
impl function received an arbitrary buffer size
(Modules/clinic/_testclinic.c.h:1531, c_length).
Solution: Initialize the length variable from the parameter's default value in
Tools/clinic/libclinic/converter.py: a new CConverter.length_c_default() hook,
UTF-8 byte length for str defaults, 0 for None/NULL; regenerate the affected
clinic files and add regression tests for calls with omitted arguments.
Signed-off-by: a.burlakov (a.burlakov@fobos-nt.ru)1 parent 91ab655 commit e13019b
6 files changed
Lines changed: 58 additions & 12 deletions
File tree
- Lib/test
- Modules/clinic
- Tools/clinic/libclinic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2043 | 2043 | | |
2044 | 2044 | | |
2045 | 2045 | | |
2046 | | - | |
| 2046 | + | |
2047 | 2047 | | |
2048 | | - | |
| 2048 | + | |
2049 | 2049 | | |
2050 | | - | |
| 2050 | + | |
2051 | 2051 | | |
2052 | 2052 | | |
2053 | 2053 | | |
| |||
2065 | 2065 | | |
2066 | 2066 | | |
2067 | 2067 | | |
2068 | | - | |
| 2068 | + | |
2069 | 2069 | | |
2070 | 2070 | | |
2071 | 2071 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1711 | 1711 | | |
1712 | 1712 | | |
1713 | 1713 | | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
1714 | 1725 | | |
1715 | 1726 | | |
1716 | 1727 | | |
| |||
4909 | 4920 | | |
4910 | 4921 | | |
4911 | 4922 | | |
| 4923 | + | |
| 4924 | + | |
4912 | 4925 | | |
4913 | 4926 | | |
4914 | 4927 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
289 | 296 | | |
290 | 297 | | |
291 | 298 | | |
| |||
445 | 452 | | |
446 | 453 | | |
447 | 454 | | |
448 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
449 | 466 | | |
450 | 467 | | |
451 | 468 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
831 | 843 | | |
832 | 844 | | |
833 | 845 | | |
| |||
1065 | 1077 | | |
1066 | 1078 | | |
1067 | 1079 | | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1068 | 1084 | | |
1069 | 1085 | | |
1070 | 1086 | | |
| |||
0 commit comments