Kim van der Riet created PROTON-2071:
----------------------------------------
Summary: [Python] Proton integral type constructors and
Data.put_*() methods need bounds checking
Key: PROTON-2071
URL: https://issues.apache.org/jira/browse/PROTON-2071
Project: Qpid Proton
Issue Type: Bug
Components: python-binding
Reporter: Kim van der Riet
Assignee: Kim van der Riet
Using an out-of-bounds value to construct any integral type (except {{long}})
is simply accepted without an error:
{noformat}
>>> proton.byte(12345)
byte(12345)
{noformat}
Using an out-of-bounds value (or an out-of-bounds integral type described
above) on a {{Data.put_*()}} method results in an {{OverflowError}}:
{noformat}
>>> d = proton.Data()
>>> d.put_byte(12345)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kvdr/RedHat/install/lib64/proton/bindings/python/proton/_data.py",
line 649, in put_byte
self._check(pn_data_put_byte(self._data, b))
OverflowError: in method 'pn_data_put_byte', argument 2 of type 'int8_t'
{noformat}
A value range check needs to be made on all the integral constructors (except
{{long}} which does not have this issue, and {{ulong}} which has already been
fixed for negative values, see below) and {{Data.put_*()}} methods, and an
{{AssertionError}} thrown if the supplied value is out-of-range.
See PROTON-2038 for original limited fix for negative values on unsigned type
constructors only.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]