Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing negative array size check in Slice#allocate #170

Open
kasiafi opened this issue Apr 5, 2024 · 0 comments
Open

Missing negative array size check in Slice#allocate #170

kasiafi opened this issue Apr 5, 2024 · 0 comments

Comments

@kasiafi
Copy link

kasiafi commented Apr 5, 2024

This is a public method. Experience would be better if negative array size produced a user-friendly message, similar to the one we get for too large size.

https://github.com/airlift/slice/blob/master/src/main/java/io/airlift/slice/Slices.java#L83:L92

On negative size, throws

java.lang.NegativeArraySizeException: -2147483636
	at io.airlift.slice.Slices.allocate(Slices.java:91)
	at io.trino.execution.buffer.PageSerializer$WriteBuffer.<init>(PageSerializer.java:626)
	at io.trino.execution.buffer.PageSerializer$SerializedPageOutput.startPage(PageSerializer.java:154)
	at io.trino.execution.buffer.PageSerializer.serialize(PageSerializer.java:83)
	at io.trino.spiller.FileSingleStreamSpiller.writePages(FileSingleStreamSpiller.java:157)
	at io.trino.spiller.FileSingleStreamSpiller.lambda$spill$0(FileSingleStreamSpiller.java:123)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant