Sergey,

Thanks your fix. I will help to check-in later.


Reviewed-by: Jeff Fan <[email protected]<mailto:[email protected]>>

Jeff
From: Sergey Isakov [mailto:[email protected]]
Sent: Friday, July 11, 2014 4:42 PM
To: [email protected]
Subject: [edk2] [BUG] Possible array out of bounds

Hi,
I checked EDK2 sources with cppcheck program and found this mistake
edk2/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c:line582
------
  for (OptionIndex = 0; (OptionOrder[OptionIndex] != 0 && OptionIndex < 
MAX_MENU_NUMBER); OptionIndex++) {

------
Warning said
---
The variable 'OptionIndex' is used as an array index before it is checked that 
is within limits. This can mean that the array might be accessed out of bounds. 
Reorder conditions such as '(a[i] && i < 10)' to '(i < 10 && a[i])'. That way 
the array will not be accessed if the index is out of limits.
---
I agree, the line should be
------
for (OptionIndex = 0; (OptionIndex < MAX_MENU_NUMBER && 
OptionOrder[OptionIndex] != 0); OptionIndex++) {
------

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by:  [email protected]<mailto:[email protected]>

Wishes,
Sergey
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck&#174;
Code Sight&#153; - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to