You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mohanraj Loganathan (JIRA)" <ji...@apache.org> on 2010/08/31 11:53:53 UTC

[jira] Created: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

[classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
--------------------------------------------------------------------------------------------------

                 Key: HARMONY-6639
                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: All Unix platforms 
            Reporter: Mohanraj Loganathan


fd's passed c functions needs casting from long to int to avoid potential problems

Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.

mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
fstat((int)fd - FD_BIAS, &statbuf)

typecasting them to int will avoid the truncation issues.

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


[jira] Commented: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909096#action_12909096 ] 

Hudson commented on HARMONY-6639:
---------------------------------

Integrated in Harmony-1.5-head-linux-x86_64 #942 (See [https://hudson.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/942/])
    Applied patches (Mohan's and all but the duplicate chunk from Cath's)
from "[#HARMONY-6639] [classlib][luni]fd's passed c
functions needs casting from long to int to avoid potential problems".


> [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6639
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All Unix platforms 
>            Reporter: Mohanraj Loganathan
>            Assignee: Mark Hindess
>         Attachments: 6639-2.patch, 6639.patch, HARMONY-6639.patch
>
>
> fd's passed c functions needs casting from long to int to avoid potential problems
> Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.
> mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
> fstat((int)fd - FD_BIAS, &statbuf)
> typecasting them to int will avoid the truncation issues.

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


[jira] Updated: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

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

Catherine Hope updated HARMONY-6639:
------------------------------------

    Attachment: 6639-2.patch

Thanks Mark - the patches are applied as expected, but I found a few more places that missed my search pattern.  This patch has the extra casts and also removes a comment line that I don't think we need.  I've checked the Java 6 branch and couldn't find any additional places where the cast isn't happening.

> [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6639
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All Unix platforms 
>            Reporter: Mohanraj Loganathan
>            Assignee: Mark Hindess
>         Attachments: 6639-2.patch, 6639.patch, HARMONY-6639.patch
>
>
> fd's passed c functions needs casting from long to int to avoid potential problems
> Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.
> mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
> fstat((int)fd - FD_BIAS, &statbuf)
> typecasting them to int will avoid the truncation issues.

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


[jira] Commented: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909115#action_12909115 ] 

Hudson commented on HARMONY-6639:
---------------------------------

Integrated in Harmony-select-1.5-head-linux-x86_64 #104 (See [https://hudson.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/104/])
    Applied patches (Mohan's and all but the duplicate chunk from Cath's)
from "[#HARMONY-6639] [classlib][luni]fd's passed c
functions needs casting from long to int to avoid potential problems".


> [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6639
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All Unix platforms 
>            Reporter: Mohanraj Loganathan
>            Assignee: Mark Hindess
>         Attachments: 6639-2.patch, 6639.patch, HARMONY-6639.patch
>
>
> fd's passed c functions needs casting from long to int to avoid potential problems
> Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.
> mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
> fstat((int)fd - FD_BIAS, &statbuf)
> typecasting them to int will avoid the truncation issues.

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


[jira] Updated: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

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

Mohanraj Loganathan updated HARMONY-6639:
-----------------------------------------

    Attachment: HARMONY-6639.patch

Attaching patch for the same. Patch is taken from Java5 level. It can be applied to Java6 level also. 

> [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6639
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All Unix platforms 
>            Reporter: Mohanraj Loganathan
>         Attachments: HARMONY-6639.patch
>
>
> fd's passed c functions needs casting from long to int to avoid potential problems
> Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.
> mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
> fstat((int)fd - FD_BIAS, &statbuf)
> typecasting them to int will avoid the truncation issues.

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


[jira] Updated: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

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

Catherine Hope updated HARMONY-6639:
------------------------------------

    Attachment: 6639.patch

The other native function calls (readv and writev) in OSFileSystemLinux32.c also don't have the int cast.  I did a global search through the rest of the native files and didn't find any other places where the cast isn't been done.
Patch contains Mohan's fix (minus the comment) and the extra casts and improved error message for the IOException throw

> [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6639
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All Unix platforms 
>            Reporter: Mohanraj Loganathan
>         Attachments: 6639.patch, HARMONY-6639.patch
>
>
> fd's passed c functions needs casting from long to int to avoid potential problems
> Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.
> mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
> fstat((int)fd - FD_BIAS, &statbuf)
> typecasting them to int will avoid the truncation issues.

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


[jira] Assigned: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

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

Mark Hindess reassigned HARMONY-6639:
-------------------------------------

    Assignee: Mark Hindess

> [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6639
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All Unix platforms 
>            Reporter: Mohanraj Loganathan
>            Assignee: Mark Hindess
>         Attachments: 6639.patch, HARMONY-6639.patch
>
>
> fd's passed c functions needs casting from long to int to avoid potential problems
> Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.
> mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
> fstat((int)fd - FD_BIAS, &statbuf)
> typecasting them to int will avoid the truncation issues.

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


[jira] Resolved: (HARMONY-6639) [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems

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

Mark Hindess resolved HARMONY-6639.
-----------------------------------

    Resolution: Fixed

I applied the patches at r996147 - I applied Mohan's patch and then all but the duplicate chunk of Cath's patch.

Cath, can you confirm (by closing this JIRA) that this resolves the issue?


> [classlib][luni]fd's passed c functions needs casting from long to int to avoid potential problems
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6639
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6639
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All Unix platforms 
>            Reporter: Mohanraj Loganathan
>            Assignee: Mark Hindess
>         Attachments: 6639.patch, HARMONY-6639.patch
>
>
> fd's passed c functions needs casting from long to int to avoid potential problems
> Consider the functions below. Here fd is jlong. But both the functions will accept int. So this may cause some potential issues.
> mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
> fstat((int)fd - FD_BIAS, &statbuf)
> typecasting them to int will avoid the truncation issues.

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