diff options
author | Arun Kuruvila <arun.kuruvila@oracle.com> | 2015-04-24 11:30:13 +0530 |
---|---|---|
committer | Arun Kuruvila <arun.kuruvila@oracle.com> | 2015-04-24 11:30:13 +0530 |
commit | eb79ead4f01c60456977a2d27909b4aca6c29336 (patch) | |
tree | 291738d019d6309a79d3b358162ab3a164f27a7e /mysys/my_aes.c | |
parent | 3300823ca36810835c38389f3f8ea248d8895ebb (diff) | |
download | mariadb-git-eb79ead4f01c60456977a2d27909b4aca6c29336.tar.gz |
Bug#20318154 : NEGATIVE ARRAY INDEX WRITE V2
Description:- There is a possibility of negative array index
write associated with the function "terminal_writec()". This
is due to the assumption that there is a possibility of
getting -1 return value from the function call
"ct_visual_char()".
Analysis:- The function "terminal_writec()" is called only
from "em_delete_or_list()" and "vi_list_or_eof()" and both
these functions deal with the "^D" (ctrl+D) signal. So the
"size_t len" and "Char c" passed to "ct_visual_char()" (when
called from "terminal_writec()") is always 8 (macro
VISUAL_WIDTH_MAX is passed whose value is 8) and 4 (ASCII
value for "^D"/"ctrl+D") respectively.
Since the value of "c" is 4, "ct_chr_class()" returns -1
(macro CHTYPE_ASCIICTL is associated with -1 value). And
since value of "len" is 8, "ct_visual_char()" will always
return 2 when it is called from "terminal_writec()".
So there is no possible case so that we encounter a negative
array index write in "terminal_writec()". But since there is
a rare posibility of using "terminal_writec()" in future
enhancements, it is good handle the error case as well.
Fix:- A condition is added in "terminal_writec()" to check
whether "ct_visual_char()" is returning -1 or not. If the
return value is -1, then value 0 is returned to its calling
function "em_delete_or_list()" or "vi_list_or_eof()", which
in turn will return CC_ERROR.
NOTE:- No testcase is added since currently there is no
possible scenario to encounter this error case.
Diffstat (limited to 'mysys/my_aes.c')
0 files changed, 0 insertions, 0 deletions