You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Zoltan Meze (Jira)" <ji...@apache.org> on 2022/04/25 16:21:00 UTC
[jira] [Updated] (SUREFIRE-2076) BufferOverflowException when encoding message with null runMode
[ https://issues.apache.org/jira/browse/SUREFIRE-2076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zoltan Meze updated SUREFIRE-2076:
----------------------------------
Description:
Per [#issuecomment-1099231382|https://github.com/apache/maven-surefire/pull/518#issuecomment-1099231382], [#issuecomment-1099706229|https://github.com/apache/maven-surefire/pull/518#issuecomment-1099706229], [#pullrequestreview-951134938|https://github.com/apache/maven-surefire/pull/518#pullrequestreview-951134938] and [#issuecomment-1108371215|https://github.com/apache/maven-surefire/pull/518#issuecomment-1108371215]
RunMode can be null causing BufferOverflowException when encoding message.
Related to similar issue with null testIds: [SUREFIRE-2056|https://issues.apache.org/jira/browse/SUREFIRE-2056]
*AbstractStreamEncoder#encodeHeader* stores runMode in at least 3 bytes:
* 1-byte length
* 1-byte delimiter
* length-bytes runMode
* 1-byte delimiter
In case of null runMode the encoded part becomes *0::* (exactly 3 bytes length)
The issue is that *AbstractStreamEncoder#estimateBufferLength* is not couting any bytes in casae of null runMode.
This results in in BufferOverflowException becase the byte size of the message is underestimated.
Exception thrown:
{code:java}
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:547)
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:172)
at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeString(AbstractStreamEncoder.java:127)
at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeStringData(AbstractStreamEncoder.java:171)
at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encode(AbstractStreamEncoder.java:157)
at org.apache.maven.surefire.booter.spi.EventChannelEncoder.encodeMessage(EventChannelEncoder.java:398)
at org.apache.maven.surefire.booter.spi.EventChannelEncoder.setOutErr(EventChannelEncoder.java:188)
at org.apache.maven.surefire.booter.spi.EventChannelEncoder.testOutput(EventChannelEncoder.java:183)
at org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:113)
at org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:44)
at org.apache.maven.surefire.common.junit4.JUnit4RunListener.writeTestOutput(JUnit4RunListener.java:235)
at org.apache.maven.surefire.api.report.ConsoleOutputCapture$ForwardingPrintStream.println(ConsoleOutputCapture.java:144)
{code}
was:
Per [#issuecomment-1099231382|https://github.com/apache/maven-surefire/pull/518#issuecomment-1099231382], [#issuecomment-1099706229|https://github.com/apache/maven-surefire/pull/518#issuecomment-1099706229], [#pullrequestreview-951134938|https://github.com/apache/maven-surefire/pull/518#pullrequestreview-951134938] and [#issuecomment-1108371215|https://github.com/apache/maven-surefire/pull/518#issuecomment-1108371215]
RunMode can be null causing BufferOverflowException when encoding message.
Related to similar issue with null testIds: [SUREFIRE-2056|https://issues.apache.org/jira/browse/SUREFIRE-2056]
Exception thrown:
{code:java}
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:547)
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:172)
at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeString(AbstractStreamEncoder.java:127)
at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeStringData(AbstractStreamEncoder.java:171)
at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encode(AbstractStreamEncoder.java:157)
at org.apache.maven.surefire.booter.spi.EventChannelEncoder.encodeMessage(EventChannelEncoder.java:398)
at org.apache.maven.surefire.booter.spi.EventChannelEncoder.setOutErr(EventChannelEncoder.java:188)
at org.apache.maven.surefire.booter.spi.EventChannelEncoder.testOutput(EventChannelEncoder.java:183)
at org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:113)
at org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:44)
at org.apache.maven.surefire.common.junit4.JUnit4RunListener.writeTestOutput(JUnit4RunListener.java:235)
at org.apache.maven.surefire.api.report.ConsoleOutputCapture$ForwardingPrintStream.println(ConsoleOutputCapture.java:144)
{code}
> BufferOverflowException when encoding message with null runMode
> ---------------------------------------------------------------
>
> Key: SUREFIRE-2076
> URL: https://issues.apache.org/jira/browse/SUREFIRE-2076
> Project: Maven Surefire
> Issue Type: Bug
> Components: Maven Surefire Plugin
> Affects Versions: 3.0.0-M6
> Reporter: Zoltan Meze
> Priority: Major
>
> Per [#issuecomment-1099231382|https://github.com/apache/maven-surefire/pull/518#issuecomment-1099231382], [#issuecomment-1099706229|https://github.com/apache/maven-surefire/pull/518#issuecomment-1099706229], [#pullrequestreview-951134938|https://github.com/apache/maven-surefire/pull/518#pullrequestreview-951134938] and [#issuecomment-1108371215|https://github.com/apache/maven-surefire/pull/518#issuecomment-1108371215]
> RunMode can be null causing BufferOverflowException when encoding message.
> Related to similar issue with null testIds: [SUREFIRE-2056|https://issues.apache.org/jira/browse/SUREFIRE-2056]
> *AbstractStreamEncoder#encodeHeader* stores runMode in at least 3 bytes:
> * 1-byte length
> * 1-byte delimiter
> * length-bytes runMode
> * 1-byte delimiter
> In case of null runMode the encoded part becomes *0::* (exactly 3 bytes length)
> The issue is that *AbstractStreamEncoder#estimateBufferLength* is not couting any bytes in casae of null runMode.
> This results in in BufferOverflowException becase the byte size of the message is underestimated.
> Exception thrown:
> {code:java}
> java.nio.BufferOverflowException
> at java.nio.Buffer.nextPutIndex(Buffer.java:547)
> at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:172)
> at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeString(AbstractStreamEncoder.java:127)
> at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeStringData(AbstractStreamEncoder.java:171)
> at org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encode(AbstractStreamEncoder.java:157)
> at org.apache.maven.surefire.booter.spi.EventChannelEncoder.encodeMessage(EventChannelEncoder.java:398)
> at org.apache.maven.surefire.booter.spi.EventChannelEncoder.setOutErr(EventChannelEncoder.java:188)
> at org.apache.maven.surefire.booter.spi.EventChannelEncoder.testOutput(EventChannelEncoder.java:183)
> at org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:113)
> at org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:44)
> at org.apache.maven.surefire.common.junit4.JUnit4RunListener.writeTestOutput(JUnit4RunListener.java:235)
> at org.apache.maven.surefire.api.report.ConsoleOutputCapture$ForwardingPrintStream.println(ConsoleOutputCapture.java:144)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)