.bf extraction - memory allocation problem

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Omnitrix
Posts: 19
Joined: Fri Aug 31, 2018 11:24 pm

.bf extraction - memory allocation problem

Post by Omnitrix »

Hello! I am trying to unpack Michael Jackson The Experience (PS3) .bf archive and getting this error in a middle of extraction:

- error in src\extra\xalloc.c line 618: xdbg_malloc()

Error: memory allocation problem

I am using this script:

Code: Select all

# The Adventures of Tintin / Ubisoft BBF (script 0.1.4)
# script for QuickBMS http://quickbms.aluigi.org

comtype lzo1x
idstring "ABE"
get DUMMY byte
get DUMMY long
get DUMMY long
get DUMMY long
get DUMMY long
get DUMMY long
get NEXT long
get DUMMY long
get ROOT long
get DUMMY long
get DUMMY long  # packs?
get FILES long
do
    goto NEXT
    get FILES long
    get PREV long
    get NEXT long
    for i = 0 < FILES
        getdstring NAME 0x50
        if NAME == ""
            break   # in case the FILES calculation is wrong
        endif
        get ZERO long
        if ZERO == 0xfafafafa
            break
        endif
        get PREV_FILE long
        get ZSIZE long
        get TIMESTAMP longlong
        get CRC long
        get DUMMY long
        get OFFSET long
        get DUMMY long
        get SIZE long
        getdstring DUMMY 0x50
        string NAME R= "_" "/"
        savepos TMP
        goto OFFSET
        get ZSIZE long
        get SIZE long
        get DUMMY long
        get TEST long
        math OFFSET += 0x20

        if TEST == 3    # apparently this is correct
            math SIZE = ZSIZE
        endif
        if SIZE == 0
            math SIZE = ZSIZE   # just a test
        endif
        if SIZE != 0
            if ZSIZE == SIZE
                goto OFFSET
                getdstring SIGN 4
                if SIGN == "LySE"
                    math OFFSET += 0x14
                    math SIZE   -= 0x14
                endif
                log NAME OFFSET SIZE
            else
                if TEST >= 4
                    goto OFFSET
                    get DUMMY long  # 1
                    get NUM long
                    xmath OFFSET "OFFSET + (4 + 4 + (NUM * 4))"
                    xmath ZSIZE  "ZSIZE  - (4 + 4 + (NUM * 4))"
                endif
                clog NAME OFFSET ZSIZE SIZE
            endif
        endif
        goto TMP
    next i
    if NEXT == 0xaaaaaaaa || NEXT == 0x7f7f7f7f
        math NEXT = 0xffffffff
    endif
while NEXT != 0xffffffff
Omnitrix
Posts: 19
Joined: Fri Aug 31, 2018 11:24 pm

Re: .bf extraction - memory allocation problem

Post by Omnitrix »

Sorry, but no one?
aaa801
Posts: 48
Joined: Wed Oct 12, 2016 12:22 pm

Re: .bf extraction - memory allocation problem

Post by aaa801 »

without a sample file or the script you used linked, you likely won't get many takers.
Omnitrix
Posts: 19
Joined: Fri Aug 31, 2018 11:24 pm

Re: .bf extraction - memory allocation problem

Post by Omnitrix »

aaa801 wrote:without a sample file or the script you used linked, you likely won't get many takers.

The main file is 14 gb and extracting breaking in a middle of the process :(
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: .bf extraction - memory allocation problem

Post by aluigi »

No need to upload 14Gb because nobody is going to download it.
Long story short the format is a mess.

What I can suppose based on the large size of the file is that some 32bit fields probably must be set to 64bit, for example OFFSET which is used as absolute position and can't be 32bit.
The problem is that the original formats used a 32bit offset followed by a DUMMY which is usually used for non-zero values.
You can try to replace "get OFFSET long" with "get OFFSET longlong" and later (if still not working) remove the "get DUMMY long" after it