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

Buffer filled with zero-characters is returnred instead of actual content of page when page number more than 64 K [PYFB73] #89

Closed
firebird-automations opened this issue Jan 20, 2018 · 3 comments

Comments

@firebird-automations
Copy link

Submitted by: @pavel-zotov

It seems that fdb incorrectly handles with obtaining page content when page number more than 64 K.
Please download this big .fdb (made in recent 2.5.x) :

https://yadi.sk/d/p0BYEF0c3RZtr8

(9 files of .7z format, total size after unpacking will be ~65 Gb).
Page size of this DB = 8192 byte

When i get content of page N 8317600:
...
page_buffer = con.get_page_contents( page_number )
(page_type,) = unpack_from('<b',page_buffer)
...

- it looks like buffer containing 8292 characters with ascii code = 0.

But actually this is pointer page of relation with id = 259 (hex 103).
Here is starting part of this page how it looks in hex editor:

fdd540000 : 0004 3039 0d89 0000 0000 0000 0000 0000
fdd540010 : 0069 0000 ee9e 007f 0780 0103 0009 0000

/* fdd540000 hex == 8317600 dec; 103 hex = 259 dec */

@firebird-automations
Copy link
Author

Commented by: @dyemanov

In database_info (http://fbcore.py) I see:

    if info\_code == fb\_info\_page\_contents:
        request\_buffer \+= int\_to\_bytes\(2, 2\)
        request\_buffer \+= int\_to\_bytes\(page\_number, 4\)

I believe the first packed chunk should be:

        request\_buffer \+= int\_to\_bytes\(4, 2\)

as it represents the length of the page number.

That said, I dunno why error is not thrown in this case (AFAIU, remaining two bytes should be parsed by the server as next info items and this is unlikely to succeed).

@firebird-automations
Copy link
Author

Modified by: @pcisar

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0 [ 10872 ]

@firebird-automations
Copy link
Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants