You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Kim van der Riet (JIRA)" <ji...@apache.org> on 2019/06/20 18:04:00 UTC

[jira] [Updated] (PROTON-2071) [Python] Proton integral type constructors and Data.put_*() methods need bounds checking

     [ https://issues.apache.org/jira/browse/PROTON-2071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim van der Riet updated PROTON-2071:
-------------------------------------
    Description: 
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 "/usr/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.

  was:
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.


> [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
>            Priority: Major
>
> 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 "/usr/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: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org