Skip to content

Commit b915a1d

Browse files
nielsdosalexdowad
authored andcommitted
Fix uninitialised variable warning in mbfilter_sjis.c
Compiling in release mode with UBSAN gives me the following compiler warning: ``` In function ‘mb_wchar_to_sjismac’: mbfilter_sjis.c:1419:89: warning: ‘i’ may be used uninitialized [-Wmaybe-uninitialized] 1419 | buf->state = (i << 24) | (index << 16) | (w & 0xFFFF); | ^~ mbfilter_sjis.c:1398:42: note: ‘i’ was declared here 1398 | for (int i = 0; i < code_tbl_m_len; i++) { | ^ ``` Since the if condition will always be taken after the goto, we can get rid of the warning by moving the label inside the if. Signed-off-by: Alex Dowad <alexinbeijing@gmail.com>
1 parent 4f74e86 commit b915a1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/mbstring/libmbfl/filters/mbfilter_sjis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,8 +1400,8 @@ process_codepoint: ;
14001400
/* This might be a valid transcoding hint sequence */
14011401
int index = 3;
14021402

1403-
resume_transcoding_hint:
14041403
if (buf->state) {
1404+
resume_transcoding_hint:
14051405
i = buf->state >> 24;
14061406
index = (buf->state >> 16) & 0xFF;
14071407
buf->state = 0;

0 commit comments

Comments
 (0)