coverity/13763: Out-of-bounds read: FP.

Problem    : Out-of-bound read from a buffer.
Diagnostic : False positive.
Rationale  : nv_max_linear should always be less than nv_cmd_idx size
             (NV_CMDS_SIZE).
Resolution : Assert rationale.
This commit is contained in:
Eliseo Martínez 2015-01-08 20:43:00 +01:00
parent d96e1c1ec3
commit aeb68bbb07

View File

@ -11,6 +11,7 @@
* the operators.
*/
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <string.h>
@ -388,6 +389,7 @@ static int find_command(int cmdchar)
/* If the character is in the first part: The character is the index into
* nv_cmd_idx[]. */
assert(nv_max_linear < (int)NV_CMDS_SIZE);
if (cmdchar <= nv_max_linear)
return nv_cmd_idx[cmdchar];