smartdevicelink/sdl_java_suite

Error Code is cut off from bulk data when reading a SEND_INTERNAL_ERROR query

Closed this issue · 1 comments

Bug Summary

When reading a received SEND_INTERNAL_ERROR query from Core, the library cuts off the first bulkData byte:

if (msg.getQueryType() == SecurityQueryType.NOTIFICATION && msg.getQueryID() == SecurityQueryID.SEND_INTERNAL_ERROR) {
    _bulkData = new byte[binHeader.length - _jsonSize - SECURITY_QUERY_HEADER_SIZE - 1];
} else {
    _bulkData = new byte[binHeader.length - _jsonSize - SECURITY_QUERY_HEADER_SIZE];
}
System.arraycopy(binHeader, SECURITY_QUERY_HEADER_SIZE + _jsonSize, _bulkData, 0, _bulkData.length);
msg.setBulkData(_bulkData);

This results in the library not being able to read this data later:

if (receivedHeader.getBulkData() != null && receivedHeader.getBulkDataSize() == 1) {
    DebugTool.logError(TAG, "Security Query module internal error: " + SecurityQueryErrorCode.valueOf(receivedHeader.getBulkData()[0]).getName());
} else {
    DebugTool.logError(TAG, "Security Query module error: No information provided");
}

This should be changed to:

_bulkData = new byte[binHeader.length - _jsonSize - SECURITY_QUERY_HEADER_SIZE];
System.arraycopy(binHeader, SECURITY_QUERY_HEADER_SIZE + _jsonSize, _bulkData, 0, _bulkData.length);
msg.setBulkData(_bulkData);

Reproduction Steps

  1. Attempt to test Encrypted Video Streaming using an app with the app ID wrong_app_id and the default security lib

Expected Behavior:
Encrypted Video Streaming fails with the following log

Security Query module internal error: INVALID_CERT

Observed Behavior:

Encrypted Video Streaming fails with the following log

Security Query module error: No information provided

Which projects have you seen this bug on?

No response

Android Version(s)

9

Android Device(s)

Galaxy S9

sdl_java_suite Version

develop

Testing Environment(s)

SDL Core `release/8.1.0` branch + Generic_HMI `release/0.12.0` branch

Relevant log output

No response

Fixed with #1791