don't trust crc when size is zero
This commit is contained in:
@@ -90,7 +90,7 @@ export const applyPacket = ({
|
|||||||
const dataSize = PacketUtils.getPacketDataByteCount();
|
const dataSize = PacketUtils.getPacketDataByteCount();
|
||||||
const offset = sequence * dataSize;
|
const offset = sequence * dataSize;
|
||||||
const length = offset + dataSize;
|
const length = offset + dataSize;
|
||||||
if(crc === actualCrc) {
|
if(crc === actualCrc && size !== 0) {
|
||||||
if(FAILED_SEQUENCES.includes(sequence)) {
|
if(FAILED_SEQUENCES.includes(sequence)) {
|
||||||
FAILED_SEQUENCES.splice(FAILED_SEQUENCES.indexOf(sequence), 1);
|
FAILED_SEQUENCES.splice(FAILED_SEQUENCES.indexOf(sequence), 1);
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,10 @@ export const getSizeAvailable = () => {
|
|||||||
}
|
}
|
||||||
export const isSizeTrusted = () => {
|
export const isSizeTrusted = () => {
|
||||||
if(!getSizeAvailable()) return false;
|
if(!getSizeAvailable()) return false;
|
||||||
if(DATA_SIZE_CRC_BIT_COUNT !== 0) return getSizeCrcPassed();
|
if(DATA_SIZE_CRC_BIT_COUNT !== 0) {
|
||||||
|
if(getSize() === 0) return false;
|
||||||
|
return getSizeCrcPassed();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
export const getSize = () => {
|
export const getSize = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user