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

isc_vax_integer() and isc_portable_integer() work wrongly with short negative numbers [CORE5675] #5941

Closed
firebird-automations opened this issue Dec 5, 2017 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @aafemt

Assigned to: @aafemt

Attachments:
port_test.cpp.7z

When the functions gather negative value with length less than 4 and 8 bytes respectively, they loose sign. Now it can be seen only with isc_portable_integer() because standard providers use only 4 or 8 bytes for values. Third-party providers can ignore this old convention.

Commits: b039792 c678d20 0b0d6dd

====== Test Details ======

It seems that some bug exists in function _renderSizedIntegerForSPB from fdb package (http://services.py):
iRaw = struct.pack(myformat, i)
iConv = api.isc_vax_integer(iRaw, len(iRaw))
This function cuts off high 4 bytes when we pass to it bugint values greater than 2^31, i.e.:
2147483648L ==> reversed = b'\x00\x00\x00\x00\x00\x00\x00\x00'
-2147483649L ==> reversed = b'\x00\x00\x00\x00\x00\x00\x00\x00'

For this reason it was decided currently to limit scope by specifying numbers with abs() less than 2^31 - untill fdb driver will be fixed.
See letter from dimitr 08-jan-2018 20:56

@firebird-automations
Copy link
Collaborator Author

Commented by: @aafemt

Test application attached.

@firebird-automations
Copy link
Collaborator Author

Modified by: @aafemt

Attachment: port_test.cpp.7z [ 13189 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @aafemt

summary: isc_vax_integer() and isc_portable_integer() wron work with short negative numbers => isc_vax_integer() and isc_portable_integer() wrong work with short negative numbers

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.8 [ 10809 ]

Fix Version: 3.0.3 [ 10810 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

assignee: Dimitry Sibiryakov [ aafemt ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

summary: isc_vax_integer() and isc_portable_integer() wrong work with short negative numbers => isc_vax_integer() and isc_portable_integer() work wrongly with short negative numbers

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Cannot be tested

Test Details: Letter from dimitr, 28.12.2017 10:27

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: Cannot be tested => Done with caveats

Test Details: Letter from dimitr, 28.12.2017 10:27 => It seems that some bug exists in function _renderSizedIntegerForSPB from fdb package (http://services.py):
iRaw = struct.pack(myformat, i)
iConv = api.isc_vax_integer(iRaw, len(iRaw))
This function cuts off high 4 bytes when we pass to it bugint values greater than 2^31, i.e.:
2147483648L ==> reversed = b'\x00\x00\x00\x00\x00\x00\x00\x00'
-2147483649L ==> reversed = b'\x00\x00\x00\x00\x00\x00\x00\x00'

For this reason it was decided currently to limit scope by specifying numbers with abs() less than 2^31 - untill fdb driver will be fixed.
See letter from dimitr 08-jan-2018 20:56

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