moonlightingLL opened a new pull request, #5360:
URL: https://github.com/apache/hbase/pull/5360

   In `ByteBuffAllocator.java`, there is no value checking for `poolBufSize` 
and this variable is directly used to calculate the `bufsForTwoMB`. When 
`poolBufSize` is mistakenly set to 0, the code would cause division by 0 and 
throw ArithmeticException to crash the system.
   
   ```java
   public static ByteBuffAllocator create(Configuration conf, boolean 
reservoirEnabled) {
       int poolBufSize = conf.getInt(BUFFER_SIZE_KEY, DEFAULT_BUFFER_SIZE);
       if (reservoirEnabled) {
       . . .
       int bufsForTwoMB = (2 * 1024 * 1024) / poolBufSize;
       . . .
   ```
   
   I add a piece of code to check whether `poolBufSize` is equal to 0 during 
runtime, and if it's 0, it will raise an `IllegalArgumentException` exception 
with the given message.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to