-
Notifications
You must be signed in to change notification settings - Fork 419
Fix handling of OIDs >= 2**31 #300
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
Conversation
asyncpg/connection.py
Outdated
@@ -912,7 +912,7 @@ def __aiter__(self): | |||
raise ValueError('unknown type: {}.{}'.format(schema, typename)) | |||
|
|||
oid = typeinfo['oid'] | |||
if typeinfo['kind'] != b'b' or typeinfo['elemtype']: | |||
if typeinfo['kind'] not in (b'b', b'd') or typeinfo['elemtype']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment what b'b'
and b'd'
mean
asyncpg/protocol/codecs/base.pyx
Outdated
except OverflowError: | ||
overflow = True | ||
|
||
if overflow or (oid < 0 or oid > 4294967295L): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4294967295L -> 0xFFFFFFFF?
asyncpg/protocol/codecs/misc.pyx
Outdated
@@ -37,7 +37,7 @@ cdef init_pseudo_codecs(): | |||
for oid_type in oid_types: | |||
register_core_codec(oid_type, | |||
<encode_func>&int4_encode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add uint4_encode
with validation?
Previously this was disallowed for no particular reason.
The current `TestCase.start_cluster()` helper is not flexible enough as it does not allow making customizations to the cluster before it is started. The new `TestCase.new_cluster()` and `TestCase.start_cluster()` are now used instead. Cluster cleanup is now automatic.
Currently asyncpg (incorrectly) assumes OIDs to be signed 32-bit integers, whereas in reality they are unsigned. As a result, things would crash once the OID sequence reaches 2**31. Fix this by decoding OID values as unsigned longs. Fixes: #279
Currently asyncpg (incorrectly) assumes OIDs to be signed 32-bit
integers, whereas in reality they are unsigned. As a result, things
would crash once the OID sequence reaches 2**31.
Fix this by decoding OID values as unsigned longs.
Fixes: #279