[GitHub] [hadoop] GauthamBanasandra commented on pull request #2857: HDFS-15949. Fix integer overflow

2021-04-02 Thread GitBox


GauthamBanasandra commented on pull request #2857:
URL: https://github.com/apache/hadoop/pull/2857#issuecomment-812820177


   We can observe that `Max int64_t + 1` and `Min int64_t` are equal.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] GauthamBanasandra commented on pull request #2857: HDFS-15949. Fix integer overflow

2021-04-02 Thread GitBox


GauthamBanasandra commented on pull request #2857:
URL: https://github.com/apache/hadoop/pull/2857#issuecomment-812820088


   I was able to verify this change using the following standalone C++ program -
   ```cpp
   #include 
   #include 
   #include 
   
   int main(int argc, char *argv[]) {
 std::cout << "Max int64_t = " << std::numeric_limits::max()
   << std::endl;
 std::cout << "Max int64_t + 1 = " << std::numeric_limits::max() + 
1
   << std::endl;
 std::cout << "Min int64_t = " << std::numeric_limits::min()
   << std::endl;
 return 0;
   }
   ```
   
   Output -
   ```
   Max int64_t = 9223372036854775807
   Max int64_t + 1 = -9223372036854775808
   Min int64_t = -9223372036854775808
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] GauthamBanasandra commented on pull request #2857: HDFS-15949. Fix integer overflow

2021-04-02 Thread GitBox


GauthamBanasandra commented on pull request #2857:
URL: https://github.com/apache/hadoop/pull/2857#issuecomment-812819946


   This PR fixes some warnings reported as part of 
https://github.com/apache/hadoop/pull/2792.
   
   ```
   [ 63%] Building CXX object 
main/native/libhdfspp/tests/CMakeFiles/hdfs_ext_hdfspp_test_shim_static.dir/hdfs_ext_test.cc.o
   In file included from 
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/out/build/WSL-GCC-Debug/main/native/libhdfspp/googletest-src/googletest/include/gtest/gtest.h:375,
from 
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/out/build/WSL-GCC-Debug/main/native/libhdfspp/googletest-src/googlemock/include/gmock/internal/gmock-internal-utils.h:47,
from 
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/out/build/WSL-GCC-Debug/main/native/libhdfspp/googletest-src/googlemock/include/gmock/gmock-actions.h:51,
from 
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/out/build/WSL-GCC-Debug/main/native/libhdfspp/googletest-src/googlemock/include/gmock/gmock.h:59,
from 
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfspp_mini_dfs.h:24,
from 
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc:19:
   
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc:
 In member function ‘virtual void hdfs::HdfsExtTest_TestHosts_Test::TestBody()’:
   
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc:456:95:
 warning: integer overflow in expression of type ‘long int’ results in 
‘-9223372036854775808’ [-Woverflow]
 456 |   EXPECT_EQ(nullptr, hdfsGetHosts(fs, filename.c_str(), 0, 
std::numeric_limits::max()+1));
 |
~~~^~
   
/mnt/d/projects/apache/hadoop/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc:460:92:
 warning: integer overflow in expression of type ‘long int’ results in 
‘-9223372036854775808’ [-Woverflow]
 460 |   EXPECT_EQ(nullptr, hdfsGetHosts(fs, filename.c_str(), 
std::numeric_limits::max()+1, std::numeric_limits::max()));
 | 
~~~^~
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org