Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/15915#discussion_r92123402
--- Diff:
core/src/main/scala/org/apache/spark/util/io/ChunkedByteBufferOutputStream.scala
---
@@ -30,9 +31,14 @@ import org.apache.spark.storage.StorageUtils
* @param chunkSize size of each chunk, in bytes.
*/
private[spark] class ChunkedByteBufferOutputStream(
- chunkSize: Int,
+ var chunkSize: Int,
allocator: Int => ByteBuffer)
- extends OutputStream {
+ extends OutputStream with Logging{
+
+ if (chunkSize < 0) {
+ logWarning(s"chunkSize should not be an negative value, replaced as
4MB default.")
+ chunkSize = 4 * 1024 * 1024
+ }
--- End diff --
This doesn't fix the issue, because a value > Int.MaxValue can still
truncate to a (wrong) positive Int.
If protecting against Long values > Int.MaxValue is the least we can do to
address this problem, we should actually do that. It can't be that many call
sites right?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]