Skip to content

flashimage: remove unnecessary ord()#34

Open
osresearch wants to merge 1 commit intoohjeongwook:masterfrom
osresearch:image-file-fix
Open

flashimage: remove unnecessary ord()#34
osresearch wants to merge 1 commit intoohjeongwook:masterfrom
osresearch:image-file-fix

Conversation

@osresearch
Copy link

When running with an image file there is an error in the call to ord() on the body:

% python3 dumpflash.py -i raw.rom -P 0x2000 -O 64 --bp 64 -c check_ecc
PageSize: 0x2000
OOBSize: 0x40
PagePerBlock: 0x40
BlockSize: 0x80000
RawPageSize: 0x2040
FileSize: 0x10800000
PageCount: 0x8400

Traceback (most recent call last):
  File "dumpflash.py", line 160, in <module>
    flash_image_io.check_ecc()
  File "/home/hudson/sec/nand/dumpflash/dumpflash/flashimage.py", line 73, in check_ecc
    oob_ecc0 = ord(data[self.SrcImage.PageSize])
TypeError: ord() expected string of length 1, but int found

Fixing that one produces another error in the ecc; I can't verify if this change breaks the ftdi interface:

% python3 dumpflash.py -i raw.rom -P 0x2000 -O 64 --bp 64 -c check_ecc
PageSize: 0x2000
OOBSize: 0x40
PagePerBlock: 0x40
BlockSize: 0x80000
RawPageSize: 0x2040
FileSize: 0x10800000
PageCount: 0x8400

Traceback (most recent call last):
  File "dumpflash.py", line 160, in <module>
    flash_image_io.check_ecc()
  File "/home/hudson/sec/nand/dumpflash/dumpflash/flashimage.py", line 80, in check_ecc
    (ecc0, ecc1, ecc2) = ecc_calculator.calc(body)
  File "/home/hudson/sec/nand/dumpflash/dumpflash/ecc.py", line 52, in calc
    ch = ord(body[i])
TypeError: ord() expected string of length 1, but int found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant