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

unpack requires a buffer of 8 bytes #1

Closed
Sp0Q1 opened this issue Dec 15, 2021 · 11 comments
Closed

unpack requires a buffer of 8 bytes #1

Sp0Q1 opened this issue Dec 15, 2021 · 11 comments

Comments

@Sp0Q1
Copy link

Sp0Q1 commented Dec 15, 2021

 File "pbd/definitions.py", line 389, in __init__
    length1, length2 = struct.unpack("<II", file.read(8))
  File "pbd/definitions.py", line 260, in __init__
    self.const_ = ConstData(file)
  File "pbd/definitions.py", line 1149, in __init__
    temp = Lookup(file)
  File "analyse_folder.py", line 22, in <module>
    group = definitions.Group(os.path.join(sys.argv[1], file))

on command python3 analyse_folder.py <output-folder-of-pbd_dump>

I cannot share the file that I am investigating, but I am investigating this issue.

@sijms
Copy link
Owner

sijms commented Dec 16, 2021

can you tell me the extension of the file that make the problem
know the decompiler is support the following format ("win", "fun", "udo")

@Sp0Q1
Copy link
Author

Sp0Q1 commented Dec 16, 2021

it's an udo file, which came out of the pbd_dump.py command.

@sijms
Copy link
Owner

sijms commented Dec 16, 2021

the error occur at line which read the group name (at the beginning of reading operation)

temp = Lookup(file)
    if len(temp) > 0:
        self.group_name = temp[0].name

and according to the error the file is end!
there will be 2 possible cause for this
1- the file version is different from the version I test against = PowerBuilder 11.5
2- the problem is related to the file
to solve the issue I need to ask you
does the tool make a successful decompilation for other files especially (udo) in your pbd library?
if the answer is yes this means that the problem is related to this file only
otherwise I suggest the version difference

@dcsnetlink
Copy link

Greetings. I am facing the same issue when I use this to decompile a fun file.
I can successfully decompile the fun files from the pbd. The same occurs with all fun files.
Can you suggest a work around? If needed, I can send you the file(s).

Thank you.

@sijms
Copy link
Owner

sijms commented Aug 23, 2022

ok send and I will test

@dcsnetlink
Copy link

dcsnetlink commented Aug 24, 2022 via email

@sijms
Copy link
Owner

sijms commented Aug 30, 2022

I find the problem by comparing your file and another file with me
your file header:

00000000 | 4f 01 03 00 7d 40 01 00 | 10 00 00 00 24 51 d5 59 
00000010 | 00 00 00 00 15 f3 a6 5a | 00 00 00 00 08 00 00 00

and my file

00000000 | 41 01 03 00 77 40 01 00 | 10 00 00 00 83 91 0e 5b 
00000010 | 5e de bc 61 08 00 00 00

as you see the difference is as follow:
1- header 1 your file = 0x14F. my file 0x141
2- system class id your file = 0x407d my file = 0x4077
3- time of creation: your file = 8 bytes. my file = 4 bytes
4- time of modification: your file = 8 bytes. my file = 4 bytes

the 2 item 4 + 4 bytes difference make the error

@sijms
Copy link
Owner

sijms commented Aug 30, 2022

what I will do to solve the problem is hardcode values like this

if self.h1 == 0x14f:
    c_date_id, m_date_id, self.h5 = struct.unpack("<QQI", file.read(0x14))
else:
    c_date_id, m_date_id, self.h5 = struct.unpack("<III", file.read(0xC))

@sijms
Copy link
Owner

sijms commented Aug 30, 2022

now this code will raise exception:

        if class_type == 0x4000:
            if pcode.args[1] not in (0x40CF, 0x40D0):
                raise Exception("unknown module no.: {}".format(hex(pcode.args[1])))
Exception: unknown module no.: 0x40d5

this means your power builder virtual machine is more updated that what I have
so I need these files:
PBVM115.DLL and PBVM115.DLL.PBD

@sijms
Copy link
Owner

sijms commented Aug 31, 2022

I fix the package you can test it now

@dcsnetlink
Copy link

Your update has resolved my issue! Thank you!

@sijms sijms closed this as completed Aug 31, 2022
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

3 participants