You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Curt Jutzi (JIRA)" <ji...@apache.org> on 2014/10/11 00:21:34 UTC
[jira] [Updated] (AMQ-5389) MQTTCodec headerParser - not reducing
readSize if nulls are read
[ https://issues.apache.org/jira/browse/AMQ-5389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Curt Jutzi updated AMQ-5389:
----------------------------
Description:
in the header read you'll notice that if 0's are read, i increases to protect the end of buffer, but when you pass this down to the next parser the size of the buffer passed is readSize-1 not readSize-i
As well there is a check for readsize > 1.. this should be (readsize-i > 1)
{monospaced}
@Override
public void parse(DataByteArrayInputStream data, int readSize) throws IOException {
int i = 0;
while (i++ < readSize) {
byte b = data.readByte();
// skip repeating nulls
if (b == 0) {
continue;
}
header = b;
currentParser = initializeVariableLengthParser();
{color:red}
if (readSize > 1) {
currentParser.parse(data, readSize - 1);
{color}
}
return;
}
}
{monospaced}
was:
in the header read you'll notice that if 0's are read, i increases to protect the end of buffer, but when you pass this down to the next parser the size of the buffer passed is readSize-1 not readSize-i
As well there is a check for readsize > 1.. this should be (readsize-i > 1)
{{
@Override
public void parse(DataByteArrayInputStream data, int readSize) throws IOException {
int i = 0;
while (i++ < readSize) {
byte b = data.readByte();
// skip repeating nulls
if (b == 0) {
continue;
}
header = b;
currentParser = initializeVariableLengthParser();
{color:red}
if (readSize > 1) {
currentParser.parse(data, readSize - 1);
{color}
}
return;
}
}
}}
> MQTTCodec headerParser - not reducing readSize if nulls are read
> ----------------------------------------------------------------
>
> Key: AMQ-5389
> URL: https://issues.apache.org/jira/browse/AMQ-5389
> Project: ActiveMQ
> Issue Type: Bug
> Components: MQTT
> Affects Versions: 5.11.0
> Reporter: Curt Jutzi
>
> in the header read you'll notice that if 0's are read, i increases to protect the end of buffer, but when you pass this down to the next parser the size of the buffer passed is readSize-1 not readSize-i
> As well there is a check for readsize > 1.. this should be (readsize-i > 1)
> {monospaced}
> @Override
> public void parse(DataByteArrayInputStream data, int readSize) throws IOException {
> int i = 0;
> while (i++ < readSize) {
> byte b = data.readByte();
> // skip repeating nulls
> if (b == 0) {
> continue;
> }
> header = b;
> currentParser = initializeVariableLengthParser();
> {color:red}
> if (readSize > 1) {
> currentParser.parse(data, readSize - 1);
> {color}
> }
> return;
> }
> }
> {monospaced}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)