Title: Large InputStreams cause negative index fault · Issue #124 · json-iterator/java · GitHub
Open Graph Title: Large InputStreams cause negative index fault · Issue #124 · json-iterator/java
X Title: Large InputStreams cause negative index fault · Issue #124 · json-iterator/java
Description: The code attempts to increase the size of the buffer with a 2x multiplier until no further bytes are available. I have some concerns about this (but no concrete solution) because this in-memory approach is not a true stream. But, that as...
Open Graph Description: The code attempts to increase the size of the buffer with a 2x multiplier until no further bytes are available. I have some concerns about this (but no concrete solution) because this in-memory app...
X Description: The code attempts to increase the size of the buffer with a 2x multiplier until no further bytes are available. I have some concerns about this (but no concrete solution) because this in-memory app...
Opengraph URL: https://github.com/json-iterator/java/issues/124
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Large InputStreams cause negative index fault","articleBody":"The code attempts to increase the size of the buffer with a 2x multiplier until no further bytes are available. I have some concerns about this (but no concrete solution) because this in-memory approach is not a true stream. But, that aside, the following code within keepSkippedBytesThenRead(...) causes a problem:\r\n\r\nbyte[] newBuf = new byte[iter.buf.length * 2];\r\n\r\nThis leads to rapid increases in memory allocation for the buffer. When processing a large input you can easily roll to a negative integer and then you will obviously end up with an allocation error as the length is negative. A better approach, which I'll check in shortly, is to only increase the length of the byte array by the increment of the initially provided size in the JsonIter.parse(...). A more meaningful error than the negative index is also advised.","author":{"url":"https://github.com/ahantke","@type":"Person","name":"ahantke"},"datePublished":"2017-11-14T01:16:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/124/java/issues/124"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f2052870-6dec-9000-f9d6-04450cbedef3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBDA:154180:1AF2246:2362D12:696B34EF |
| html-safe-nonce | 4b1d24e6c4bf5a7ec330b3accc9b4f0ad3c23fb9afcb3c41d0c503e69d597e48 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkRBOjE1NDE4MDoxQUYyMjQ2OjIzNjJEMTI6Njk2QjM0RUYiLCJ2aXNpdG9yX2lkIjoiNTY4MDc2NTQ4MTEwMjU1NDM1MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4e8aff42955738adff8a9fda466b65771d4dcb73f6ceb02f921ae6758dae1641 |
| hovercard-subject-tag | issue:273634806 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/json-iterator/java/124/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0163fd91125308f04bd716f95bba21ade0c1c4d5fe1481ef413585bbe52781e3/json-iterator/java/issues/124 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0163fd91125308f04bd716f95bba21ade0c1c4d5fe1481ef413585bbe52781e3/json-iterator/java/issues/124 |
| og:image:alt | The code attempts to increase the size of the buffer with a 2x multiplier until no further bytes are available. I have some concerns about this (but no concrete solution) because this in-memory app... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ahantke |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/json-iterator/java git https://github.com/json-iterator/java.git |
| octolytics-dimension-user_id | 24260074 |
| octolytics-dimension-user_login | json-iterator |
| octolytics-dimension-repository_id | 75621695 |
| octolytics-dimension-repository_nwo | json-iterator/java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 75621695 |
| octolytics-dimension-repository_network_root_nwo | json-iterator/java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width