Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tao chen
asm
Commits
2c41f76b
Commit
2c41f76b
authored
Apr 09, 2021
by
Сергей Цыпанов
Browse files
Protect ClassReader.calculateBufferSize() from some pathological cases
parent
678fd969
Changes
1
Hide whitespace changes
Inline
Side-by-side
asm/src/main/java/org/objectweb/asm/ClassReader.java
View file @
2c41f76b
...
...
@@ -333,8 +333,13 @@ public class ClassReader {
private
static
int
calculateBufferSize
(
final
InputStream
inputStream
)
throws
IOException
{
int
expectedLength
=
inputStream
.
available
();
// some implementations can return 0 while holding available data
if
(
expectedLength
==
0
)
{
/*
* Some implementations can return 0 while holding available data
* (e.g. new FileInputStream("/proc/a_file"))
* Also in some pathological cases a very small number might be returned,
* and in this case we use default size
*/
if
(
expectedLength
<
256
)
{
return
INPUT_STREAM_DATA_CHUNK_SIZE
;
}
return
expectedLength
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment