Mercurial > octave
comparison libinterp/parse-tree/lex.ll @ 26450:af7faef288ad stable
lex.ll: Fix static analyzer detected issues (bug #55347).
* lex.ll: Use "unsigned int" as the correct resulting variable for "%o" and
"%x" sscanf conversions.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 05 Jan 2019 07:28:53 -0800 |
parents | 00f796120a6d |
children | 7647b82f921b |
comparison
equal
deleted
inserted
replaced
26449:f8107140087c | 26450:af7faef288ad |
---|---|
856 <DQ_STRING_START>\\[0-7]{1,3} { | 856 <DQ_STRING_START>\\[0-7]{1,3} { |
857 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}"); | 857 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\[0-7]{1,3}"); |
858 | 858 |
859 curr_lexer->m_current_input_column += yyleng; | 859 curr_lexer->m_current_input_column += yyleng; |
860 | 860 |
861 int result; | 861 unsigned int result; |
862 sscanf (yytext+1, "%o", &result); | 862 sscanf (yytext+1, "%o", &result); |
863 | 863 |
864 if (result > 0xff) | 864 if (result > 0xff) |
865 { | 865 { |
866 octave::token *tok | 866 octave::token *tok |
880 <DQ_STRING_START>\\x[0-9a-fA-F]+ { | 880 <DQ_STRING_START>\\x[0-9a-fA-F]+ { |
881 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+"); | 881 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\x[0-9a-fA-F]+"); |
882 | 882 |
883 curr_lexer->m_current_input_column += yyleng; | 883 curr_lexer->m_current_input_column += yyleng; |
884 | 884 |
885 int result; | 885 unsigned int result; |
886 sscanf (yytext+2, "%x", &result); | 886 sscanf (yytext+2, "%x", &result); |
887 | 887 |
888 // Truncate the value silently instead of checking the range like | 888 // Truncate the value silently instead of checking the range like |
889 // we do for octal above. This is to match C/C++ where any number | 889 // we do for octal above. This is to match C/C++ where any number |
890 // of digits is allowed but the value is implementation-defined if | 890 // of digits is allowed but the value is implementation-defined if |