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 15:58:00 UTC

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

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: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


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

Posted by Jiri Daněk <jd...@redhat.com>.
I was thinking, is Python properties feature available to Proton (regarding
supported minimal Python version)? This might be good use for it, possibly.

On Thu, Jun 20, 2019, 17:58 Kim van der Riet (JIRA) <ji...@apache.org> wrote:

> 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: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>
>