homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Explicit null dereferenced in formatter_unicode.c
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, christian.heimes, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2016年09月13日 07:32 by christian.heimes, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Messages (4)
msg276198 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016年09月13日 07:32
Coverity is warning about four cases of potential NULL forwarding in which subsequent code does not expect a NULL value.
30. no_write_call: Although get_locale_info does overwrite locale.decimal_point on some paths, it also contains at least one feasible path which does not overwrite it.
1140 /* Calculate how much memory we'll need. */
 CID 1372743: Explicit null dereferenced (FORWARD_NULL) [select issue]
 CID 1372744: Explicit null dereferenced (FORWARD_NULL) [select issue]
 CID 1372745 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)21. var_deref_model: Passing &locale to calc_number_widths, which dereferences null locale.grouping. [show details]
1141 n_total = calc_number_widths(&spec, 0, sign_char, unicode_tmp, index,
1142 index + n_digits, n_remainder, has_decimal,
1143 &locale, format, &maxchar);
1322 /* Calculate how much memory we'll need. */
 CID 1372742 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)32. var_deref_model: Passing &locale to calc_number_widths, which dereferences null locale.decimal_point. [show details]
1323 n_re_total = calc_number_widths(&re_spec, 0, re_sign_char, re_unicode_tmp,
1324 i_re, i_re + n_re_digits, n_re_remainder,
1325 re_has_decimal, &locale, &tmp_format,
1326 &maxchar);
msg276382 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016年09月14日 05:47
New changeset a27cb132e140 by Benjamin Peterson in branch '3.5':
improve type-safe of and prevent double-frees in get_locale_info (#28119)
https://hg.python.org/cpython/rev/a27cb132e140
New changeset 5ab61df1ca96 by Benjamin Peterson in branch '3.6':
merge 3.5 (#28119)
https://hg.python.org/cpython/rev/5ab61df1ca96 
msg276383 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016年09月14日 05:49
I think that should take care of it (and also possible double-frees I noticed)?
msg276390 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016年09月14日 07:48
Thanks! You fixed the problem and Coverity is no longer complaining. The code is more readable, too.
Are you talking about these lines? Yes, they were confusing me.
if (locale_info->thousands_sep == NULL) {
 Py_DECREF(locale_info->decimal_point);
}
History
Date User Action Args
2022年04月11日 14:58:36adminsetgithub: 72306
2016年09月14日 07:48:18christian.heimessetstatus: open -> closed
resolution: fixed
messages: + msg276390

stage: test needed -> resolved
2016年09月14日 05:49:22benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg276383
2016年09月14日 05:47:12python-devsetnosy: + python-dev
messages: + msg276382
2016年09月13日 09:28:50serhiy.storchakasetnosy: + vstinner, serhiy.storchaka
2016年09月13日 07:32:03christian.heimescreate

AltStyle によって変換されたページ (->オリジナル) /