Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

OnHMIStatus returns null hmiLevel if RPC has invalid/incomplete parameters #2285

Closed
conlain-k opened this issue Jun 20, 2018 · 0 comments
Closed

Comments

@conlain-k
Copy link
Contributor

conlain-k commented Jun 20, 2018

Bug Report

SDL core will return incorrect JSON in the response for an OnHMIStatus RPC if the RPC doesn't have the correct parameters.

{
   "hmiLevel" : null
}

A message uses an internal C++ map. Since maps use default-construction for accessing non-existent entries, the use of the [] accessor creates an invalid hmiLevel which is then passed to the mobile device.

This means that doing something like Map[strings::msg_params][strings::hmi_level] will create an entry if none exists. This invalid entry translates to extra JSON that lacks required fields and has a null HMI level.

Reproduction Steps

Connect any app to SDL and make an OnHMIStatus RPC with a missing parameter (for example, the new videoStreamingState parameter). SDL core will try to validate the parameters and catch the missing one, causing it to return INVALID_DATA and report a failure. However, before forwarding this message to the mobile device it attempts to perform checks on the hmiLevel field of the message. This creates an invalid HMI level which is then passed on the mobile device as a null JSON entry.

Expected Behavior

Core should return INVALID_DATA and no hmi level or other information.

Observed Behavior

Core returns INVALID_DATA but also returns an incorrect hmi level parameter.

OS & Version Information
  • OS/Version: Ubuntu 18.04
  • SDL Core Version: develop
  • Testing Against: iOS app, Generic & SDL HMIs
Test Case, Sample Code, and / or Example App

Unless the field is checked to exist first, Map[strings::msg_params][strings::hmi_level] will cause such a field to exist, even when not desired.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants