Kaydet (Commit) 8921054f authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: coverity#1242793 Untrusted value as argument

why doesn't coverity consider that Valid[Tab|Row|Col] check the lower bound of
nPos.

Could it need to be as simple as naively looking for a ">="

Change-Id: Id80f9d30b9166caef20b74569f7b50a569189d71
üst 206d68d5
...@@ -110,22 +110,22 @@ const SCROW W16MAXROW = W16MAXROWCOUNT - 1; ...@@ -110,22 +110,22 @@ const SCROW W16MAXROW = W16MAXROWCOUNT - 1;
// old stuff defines end // old stuff defines end
inline bool ValidCol( SCCOL nCol ) inline bool ValidCol( SCCOL nCol )
{ {
return static_cast<SCCOL>(0) <= nCol && nCol <= MAXCOL; return nCol >= static_cast<SCCOL>(0) && nCol <= MAXCOL;
} }
inline bool ValidRow( SCROW nRow ) inline bool ValidRow( SCROW nRow )
{ {
return static_cast<SCROW>(0) <= nRow && nRow <= MAXROW; return nRow >= static_cast<SCROW>(0) && nRow <= MAXROW;
} }
inline bool ValidTab( SCTAB nTab ) inline bool ValidTab( SCTAB nTab )
{ {
return static_cast<SCTAB>(0) <= nTab && nTab <= MAXTAB; return nTab >= static_cast<SCTAB>(0) && nTab <= MAXTAB;
} }
inline bool ValidTab( SCTAB nTab, SCTAB nMaxTab ) inline bool ValidTab( SCTAB nTab, SCTAB nMaxTab )
{ {
return static_cast<SCTAB>(0) <= nTab && nTab <= nMaxTab; return nTab >= static_cast<SCTAB>(0) && nTab <= nMaxTab;
} }
inline bool ValidColRow( SCCOL nCol, SCROW nRow ) inline bool ValidColRow( SCCOL nCol, SCROW nRow )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment