[ 
https://issues.apache.org/jira/browse/THRIFT-2757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14163505#comment-14163505
 ] 

Bret Curtis edited comment on THRIFT-2757 at 10/8/14 1:55 PM:
--------------------------------------------------------------

Yeah, sys.maxint... doesn't exist in Python3. ;)

{quote}The sys.maxint constant was removed, since there is no longer a limit to 
the value of integers. However, sys.maxsize can be used as an integer larger 
than any practical list or string index. It conforms to the implementation’s 
“natural” integer size and is typically the same as sys.maxint in previous 
releases on the same platform (assuming the same build options).{quote}

I guess we're on our own. I agree with you, this is speed critical code.


was (Author: psi29a):
Yeah, sys.maxint... doesn't exist in Python3. ;)

<blockquote>The sys.maxint constant was removed, since there is no longer a 
limit to the value of integers. However, sys.maxsize can be used as an integer 
larger than any practical list or string index. It conforms to the 
implementation’s “natural” integer size and is typically the same as sys.maxint 
in previous releases on the same platform (assuming the same build 
options).</blockquote>

I guess we're on our own. I agree with you, this is speed critical code.

> TCompactProtocol and TJSONProtocol need boundary checking
> ---------------------------------------------------------
>
>                 Key: THRIFT-2757
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2757
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library
>    Affects Versions: 0.9, 0.9.1, 0.9.2, 1.0
>            Reporter: Bret Curtis
>            Assignee: Bret Curtis
>             Fix For: 0.9.2
>
>
> On the TCompactProtocol, using i16, i32, i64 there is currently no range 
> checking happening and funky results will happen as makeZigZag will do its 
> best to handle the input. i8 (byte) is effected as it uses pack/unpack which 
> handles the case correctly.
> I wrote a test case for this using i8, i16, i32 and i64 and the result was 
> that the TJSONProtocol is also effected. It instead just took whatever value 
> it was sent regardless of type.
> I then wrote a check_boundary function to raise an exception when feed bad 
> values in a certain bitness.  This now raises an exception for both protocols.
> I also further built out the IWriteXX functions for the TJSONProtocol.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to