Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError on checking end record mark #4

Open
bradh opened this issue Sep 27, 2021 · 0 comments
Open

IndexError on checking end record mark #4

bradh opened this issue Sep 27, 2021 · 0 comments

Comments

@bradh
Copy link

bradh commented Sep 27, 2021

Traceback (most recent call last):
  File "./NPIF Sleuth.py", line 107, in <module>
    main()
  File "./NPIF Sleuth.py", line 101, in main
    retval = NPIF_Extract(fname)
  File "./NPIF Sleuth.py", line 86, in NPIF_Extract
    a.file_error_checks()
  File "/home/bradh/coding/NPIF-Sleuth/NPIF.py", line 5611, in file_error_checks
    self.check_end_record_mark()
  File "/home/bradh/coding/NPIF-Sleuth/NPIF.py", line 5787, in check_end_record_mark
    p = self.packets[-2]
IndexError: list index out of range

The relevant bit of code is:

        if d.hdr.tablecode == self.DT_End_Record_Marker_DT:
            p = self.packets[-2]

Occurs on this file:

0000000 0d 79 ab 21 6f 34 1a 72 b9 1c 03 00 02 30 00 00  >.y.!o4.r.....0..<
0000020 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00  >................<
0000040 0f 3d 00 00 00 00 00 00 99 08 00 00 00 00 01 1e  >.=..............<
0000060 60 33                                            >`3<
0000062

(i.e. there is no previous packet)

I'm not sure if a file containing only a end of record marker is valid - couldn't find an explicit statement in the STANAG, but I think that either that case should be a test failure or be silently skipped.

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

No branches or pull requests

1 participant