Fix CharArrayReader/StringBufferInputStream overflow

Port from openJdk80u112:

changeset:   11858:02d89bf02553
user:        igerasim
date:        Thu Aug 11 19:17:36 2016 +0300
summary:     8163518: Integer overflow in StringBufferInputStream.read() and CharArrayReader.read/skip()

Added test for skip overflow, no test for read overflow
because it's not possible due to memory constrains.

Test: vogar on affected tests
Bug: 31028374
Change-Id: I0fb9acdddd8376aed5f5e39d7f924cf4a5d0fce8
3 files changed