You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Hiroshi Ikeda (JIRA)" <ji...@apache.org> on 2007/03/19 03:24:09 UTC

[jira] Created: (IO-117) EndianUtils.readSwappedUnsignedInteger() may return a negative number

EndianUtils.readSwappedUnsignedInteger() may return a negative number
---------------------------------------------------------------------

                 Key: IO-117
                 URL: https://issues.apache.org/jira/browse/IO-117
             Project: Commons IO
          Issue Type: Bug
    Affects Versions: 1.3.1
            Reporter: Hiroshi Ikeda


Methods about reading unsigned-integer in class EndianUtils may return a negative number, due to casting int to long.
Calculations with operator & etc. are under integer in these methods so its results are integer,
then implicit casting the results to long keeps its positive/negative sign.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-117) EndianUtils.readSwappedUnsignedInteger() may return a negative number

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489108 ] 

Henri Yandell commented on IO-117:
----------------------------------

Do you have any particular examples/test cases in mind where there are problems, or is this theoretical?

> EndianUtils.readSwappedUnsignedInteger() may return a negative number
> ---------------------------------------------------------------------
>
>                 Key: IO-117
>                 URL: https://issues.apache.org/jira/browse/IO-117
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.3.1
>            Reporter: Hiroshi Ikeda
>
> Methods about reading unsigned-integer in class EndianUtils may return a negative number, due to casting int to long.
> Calculations with operator & etc. are under integer in these methods so its results are integer,
> then implicit casting the results to long keeps its positive/negative sign.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Closed: (IO-117) EndianUtils.readSwappedUnsignedInteger() may return a negative number

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed IO-117.
----------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.4)
                   1.3.2

Committed to both trunk (539632) and the 1.3.x branch(539638).

My understanding is that this is in time for 1.3.2.

> EndianUtils.readSwappedUnsignedInteger() may return a negative number
> ---------------------------------------------------------------------
>
>                 Key: IO-117
>                 URL: https://issues.apache.org/jira/browse/IO-117
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.3.1
>            Reporter: Hiroshi Ikeda
>             Fix For: 1.3.2
>
>         Attachments: EndianUtilsTest.java, IO-117.patch
>
>
> Methods about reading unsigned-integer in class EndianUtils may return a negative number, due to casting int to long.
> Calculations with operator & etc. are under integer in these methods so its results are integer,
> then implicit casting the results to long keeps its positive/negative sign.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-117) EndianUtils.readSwappedUnsignedInteger() may return a negative number

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated IO-117:
-----------------------------

    Attachment: IO-117.patch

Attaching a patch containing Hiroshi's test as a unit test and a proposed pair of fixes.

Opinions sought on my fix, I don't do a lot of bit shifting so it always feels clumsy.

> EndianUtils.readSwappedUnsignedInteger() may return a negative number
> ---------------------------------------------------------------------
>
>                 Key: IO-117
>                 URL: https://issues.apache.org/jira/browse/IO-117
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.3.1
>            Reporter: Hiroshi Ikeda
>         Attachments: EndianUtilsTest.java, IO-117.patch
>
>
> Methods about reading unsigned-integer in class EndianUtils may return a negative number, due to casting int to long.
> Calculations with operator & etc. are under integer in these methods so its results are integer,
> then implicit casting the results to long keeps its positive/negative sign.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-117) EndianUtils.readSwappedUnsignedInteger() may return a negative number

Posted by "Hiroshi Ikeda (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hiroshi Ikeda updated IO-117:
-----------------------------

    Attachment: EndianUtilsTest.java

Here simple test case.

> EndianUtils.readSwappedUnsignedInteger() may return a negative number
> ---------------------------------------------------------------------
>
>                 Key: IO-117
>                 URL: https://issues.apache.org/jira/browse/IO-117
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.3.1
>            Reporter: Hiroshi Ikeda
>         Attachments: EndianUtilsTest.java
>
>
> Methods about reading unsigned-integer in class EndianUtils may return a negative number, due to casting int to long.
> Calculations with operator & etc. are under integer in these methods so its results are integer,
> then implicit casting the results to long keeps its positive/negative sign.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-117) EndianUtils.readSwappedUnsignedInteger() may return a negative number

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated IO-117:
-----------------------------

    Fix Version/s: 1.4

> EndianUtils.readSwappedUnsignedInteger() may return a negative number
> ---------------------------------------------------------------------
>
>                 Key: IO-117
>                 URL: https://issues.apache.org/jira/browse/IO-117
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.3.1
>            Reporter: Hiroshi Ikeda
>             Fix For: 1.4
>
>         Attachments: EndianUtilsTest.java, IO-117.patch
>
>
> Methods about reading unsigned-integer in class EndianUtils may return a negative number, due to casting int to long.
> Calculations with operator & etc. are under integer in these methods so its results are integer,
> then implicit casting the results to long keeps its positive/negative sign.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org