Skip to content

Commit 5dd9815

Browse files
committed
Move bailout declarations to function scope to fix -Wsometimes-uninitialized
The bailout variable was declared after goto targets, so paths jumping to out: via goto could reach the if (bailout) check without the variable being initialized.
1 parent 12b48b9 commit 5dd9815

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ext/iconv/iconv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
920920
{
921921
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
922922
iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);
923+
bool bailout = false;
923924
size_t char_cnt = 0;
924925
size_t out_charset_len;
925926
size_t lfchars_len;
@@ -982,7 +983,6 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
982983

983984
char_cnt = max_line_len;
984985

985-
bool bailout = false;
986986
zend_try {
987987
_php_iconv_appendl(pretval, fname, fname_nbytes, cd_pl);
988988
char_cnt -= fname_nbytes;
@@ -1218,6 +1218,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
12181218
static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode)
12191219
{
12201220
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
1221+
bool bailout = false;
12211222

12221223
iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);
12231224

@@ -1249,7 +1250,6 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
12491250
}
12501251

12511252
p1 = str;
1252-
bool bailout = false;
12531253
zend_try {
12541254
for (str_left = str_nbytes; str_left > 0; str_left--, p1++) {
12551255
int eos = 0;

0 commit comments

Comments
 (0)