Open sgogos1 opened 3 years ago
Made a really dirty fix (not proud of it) and added a conditional statement in dis.InputStream.readByte that solved the "Offset is outside the bounds of the DataView" error I was catching.
dis.InputStream.prototype.readByte = function()
{
if (this.currentPosition !== this.dataView.byteLength){
var data = this.dataView.getInt8(this.currentPosition);
this.currentPosition = this.currentPosition + 1;
return data;
}
}
When unpackaging a DataPDU that contained a Variable Datum, the function was getting properly called while iterating through the DataView (e.g. bytelength === 176). But when it completed the last element (currentPosition === 175), it would iterate up currentPosition again (currentPosition === 176) and then call readByte again. With zero-indexing in mind, there was nothing there since the last element in the DataView was 175.
I might be missing something in my execution (outside of this fix) and am happy to know if there's a cleaner way to solve this issue. This stopped me from getting errors and returned the data pdu though.
Thanks for the report @sgogos1
Can you share a wireshark capture with the pdus that are causing the issue?
@leif81 Unfortunately due to the nature of my work (this is a work project) I can't share the data as it'd violate my employment policy. Is there another way I can help you in trying to solve this?
Repeatedly receiving the error:
"Offset is outside the bounds of the DataView" when trying to unpack Data and Event PDUs that have a fixed or variable datum attached to them.
Is there a fix to this that I'm unaware of currently?