brcm80211fwconv: Complain if the index is invalid
authorMichael Buesch <mb@bu3sch.de>
Sun, 19 Sep 2010 18:02:53 +0000 (20:02 +0200)
committerMichael Buesch <mb@bu3sch.de>
Sun, 19 Sep 2010 18:02:53 +0000 (20:02 +0200)
Signed-off-by: Michael Buesch <mb@bu3sch.de>
disassembler/brcm80211fwconv

index 880abb5d14d11e87cbc9199e231261774546ed49..092c043cfac4e3f06bc985dc282f6eac9df93b0f 100755 (executable)
@@ -161,9 +161,14 @@ def mergeSection(hdr_filepath, bin_filepath, mergeIndex, mergefilePath):
        newBin = []
        newSections = []
        newOffset = 0
+       foundIt = False
        for section in sections:
                (offset, length, index) = section
                if index == mergeIndex:
+                       if foundIt:
+                               print "Confused. Multiple sections with index %d?" % index
+                               return 1
+                       foundIt = True
                        # We overwrite this section
                        newBin.append(merge_data)
                        newSections.append( (newOffset, len(merge_data), index) )
@@ -176,6 +181,9 @@ def mergeSection(hdr_filepath, bin_filepath, mergeIndex, mergefilePath):
                                return 1
                        newSections.append( (newOffset, length, index) )
                        newOffset += length
+       if not foundIt:
+               print "Did not find section with index %d" % mergeIndex
+               return 1
        newBin = "".join(newBin)
        newHdr = generateHeaderData(newSections)
        try: