Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
All Unix platforms
-
Patch Available
Description
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.