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

FindFirst fail #78

Closed
0x140ce opened this issue Sep 24, 2019 · 6 comments
Closed

FindFirst fail #78

0x140ce opened this issue Sep 24, 2019 · 6 comments

Comments

@0x140ce
Copy link

0x140ce commented Sep 24, 2019

image
image

I use the same jpg.BT in 010edit and pfp to parse the follow jpg file ,but pfp failed to call function FindFirst()

jpg.bt.txt

1

@d0c-s4vage
Copy link
Owner

Thanks for reporting the error and including the template script and the jpg!

Could you also say which version of pfp you're using and on which platform and architecture? It looks like Windows 7

@0x140ce
Copy link
Author

0x140ce commented Sep 26, 2019

I clone from github and use cmd "python setup.py install" yesterday.
The system is windows 7 64bit.
PS:I use this cpp.exe(https://github.com/d0c-s4vage/py010parser/blob/master/utils/cpp.exe)

@d0c-s4vage
Copy link
Owner

image
reproduced

@d0c-s4vage
Copy link
Owner

Looks like pfp doesn't treat enum types correctly:

typedef enum <WORD> tagID
{
 M_SOF0 = 0xFFC0,
 M_SOF1,
 M_SOF2,
 M_SOF3,
 M_DHT,
 M_SOF5,
 M_SOF6,
 M_SOF7,
 M_JPG,
 M_SOF9,
 M_SOF10,
 M_SOF11,
 M_DAC = 0xffcc,
 M_SOF13,
 M_SOF14,
 M_SOF15,
 M_RST0 = 0xffd0,
 M_RST1, M_RST2, M_RST3, M_RST4, M_RST5, M_RST6, M_RST7,
 M_SOI = 0xFFD8,
 M_EOI,
 // ...
}

in pfp debugger, M_EOI is interpreted as an Int instead of a USHORT, which is what WORD should be:
image

I still need to trace this down a bit, there still might be something else going on

@d0c-s4vage
Copy link
Owner

Aha, pfp doesn't handle typed enums with starting values correctly. Fixing this problem in another specific ticket

@d0c-s4vage
Copy link
Owner

With #80 fixed, the output is now:

 lptp [ pfp ]: python -c "import pfp ; pfp.parse(data_file='tests/data/balloons.jpg', template_file='tests/templates/jpg.bt')"
Start of Image Marker
Start of Scan Marker
623
16012
End of File Image

This seems correct, closing the issue

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

2 participants