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

Error Facebook #110

Open
CrhistopherDiaz opened this issue Apr 9, 2023 · 2 comments
Open

Error Facebook #110

CrhistopherDiaz opened this issue Apr 9, 2023 · 2 comments

Comments

@CrhistopherDiaz
Copy link

when trying to obtain the data of the facebook or messenger application gives this error
An uncaught Exception was encountered
Type: RuntimeException

Message: Failed to read 2 bytes

Filename: \vendor\tufanbarisyildirim\php-apk-parser\lib\ApkParser\SeekableStream.php

Line Number: 146

@Qplaze
Copy link

Qplaze commented Dec 15, 2023

I have the same problem on two files. Not facebook app. Some are processed normally and some cause this error.

public function read($length = 1)
{
    // Protect against 0 byte reads when an EOF
    if ($length < 0) {
        throw new \RuntimeException('Length cannot be negative');
    }
    if ($length == 0) {
        return '';
    }

    $bytes = fread($this->stream, $length);
    if (false === $bytes || strlen($bytes) != $length) {
        return 0; //MY DIRTY FIX
        throw new \RuntimeException('Failed to read ' . $length . ' bytes');
    }
    return $bytes;
}

I examined the stream dump at this moment, and received information that the end of the file had been reached. However, there was an attempt to read two more bytes. After my crude fix, the file was read normally and all information was received. It may be worth studying this situation in more detail.

File causing the error:
https://drive.google.com/file/d/1qAYe7cwR_wGjr9TnqhznFg7GD1RE726y/view?usp=sharing

@tufanbarisyildirim
Copy link
Owner

thanks for extra information @Qplaze I will try to dig a bit more

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