You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node BACstack Version: 0.0.1-beta.10 (though I believe this to be in the present as well)
Bug Report
Current Behavior (Bug Report)
Bacnet types that are greater than 512 cause an exception. ASN1_MAX_OBJECT is defined as 0x3FF / 1023. baAsn1.encodeContextObjectId(buffer, 0, objectType, objectInstance); returns an exception for these values when it shouldn't be since they are less than 0x3FF.
value isn't intrinsically an unsigned int. It is an int. Hence it propagates a negative value which eventually throws an error when put into an unsigned buffer. A solution is as follows:
@NateZimmer sorry for the delay on this one. The whole project was more or less on ice for a while, since I was busy with other stuff...
However, a bight thanks for reporting this issue and already providing a solution 🎉 I've added it in #133 and covered it with some tests. It should be available with the next release.
Node Version:
9.1
Node BACstack Version:
0.0.1-beta.10
(though I believe this to be in the present as well)Current Behavior (Bug Report)
Bacnet types that are greater than 512 cause an exception. ASN1_MAX_OBJECT is defined as 0x3FF / 1023.
baAsn1.encodeContextObjectId(buffer, 0, objectType, objectInstance);
returns an exception for these values when it shouldn't be since they are less than 0x3FF.The issue is the following lines of code:
asn1.js
value
isn't intrinsically an unsigned int. It is an int. Hence it propagates a negative value which eventually throws an error when put into an unsigned buffer. A solution is as follows:Another example:
(512 & 0x3FF) << 22 | (1 & 0x3FFFFF )
= -2147483647((512 & 0x3FF) << 22 | (1 & 0x3FFFFF )) >>> 0
= 2147483649The text was updated successfully, but these errors were encountered: