smartdevicelink / sdl_core

SmartDeviceLink In-Vehicle Software and Sample HMI
BSD 3-Clause "New" or "Revised" License
240 stars 245 forks source link

Check if JSON value is a map before accessing members in SendInternalError handler #3896

Closed jacobkeeler closed 2 years ago

jacobkeeler commented 2 years ago

Fixes #3887 (partially, case 1)

This PR is ready for review.

Risk

This PR makes no API changes.

Testing Plan

Send a "SendInternalError" query with an integer value in the JSON data field

responseHeader.setJsonData("7".getBytes(StandardCharsets.UTF_8));

Verify that Core does not crash. ATF script to be added

Summary

If a non-object value is sent in the JSON data field of a SendInternalError query, an assertion is thrown by the JSON library. This PR adds a check to avoid this assertion.

Changelog

Bug Fixes

CLA