Closed Bug 550937 Opened 10 years ago Closed 3 years ago

coverity doesn't like nsFormHistoryImporter::AddToFormHistoryCB

Categories

(Toolkit :: Form Manager, defect)

1.9.2 Branch
x86
Linux
defect
Not set

Tracking

()

RESOLVED INVALID

People

(Reporter: timeless, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity)

this code doesn't seem present on trunk (perhaps it was deleted), which is probably a good thing....

818  	enum {
819  	  kNameColumn,
820  	  kValueColumn,
821  	  kColumnCount // keep me last
[2]

865  	nsFormHistoryImporter::AddToFormHistoryCB(const nsCSubstring &aRowID,

873  	  const PRUnichar* valueStrings[kColumnCount];
874  	  PRUint32 valueLengths[kColumnCount];

880  	  for (i = 0; i < kColumnCount; ++i) {
881  	    if (columnIndexes[i] == -1) {

Coverity claims it can reach this step for both i = 0 and i = 1, the code seems to think that can happen, since there's a 'continue' here:
882  	      // We didn't find this column in the map
883  	      continue;

909  	  }

unfortunately that means that valueStrings and valueLengths [0] and [1] are uninitialized, which makes this next line fairly troubling:

911  	  data->formHistory->AddEntry(nsDependentString(valueStrings[kNameColumn],
912  	                                                valueLengths[kNameColumn]),
913  	                              nsDependentString(valueStrings[kValueColumn],
914  	                                                valueLengths[kValueColumn]));
This code is gone.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.