From: Michael Buesch Date: Sun, 19 Sep 2010 18:02:53 +0000 (+0200) Subject: brcm80211fwconv: Complain if the index is invalid X-Git-Tag: b43-fwcutter-014~36 X-Git-Url: https://jxself.org/git/?p=b43-tools.git;a=commitdiff_plain;h=ba4d6729fd97fe5cc3602d1b2f0bef1ec47029c5 brcm80211fwconv: Complain if the index is invalid Signed-off-by: Michael Buesch --- diff --git a/disassembler/brcm80211fwconv b/disassembler/brcm80211fwconv index 880abb5..092c043 100755 --- a/disassembler/brcm80211fwconv +++ b/disassembler/brcm80211fwconv @@ -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: