Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix SIGSEGV on /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings endpoint #1952

Merged
merged 1 commit into from Jan 15, 2024

Conversation

anton-kotenko
Copy link
Contributor

@anton-kotenko anton-kotenko commented Jan 14, 2024

Editing FrequencyScanner via api endpoint cases application crash to access by null pointer.

Failure happens when swagger generated setValue method is called for complex/nested structure on the object with is created purely by constructor, but not initialised by the ::init method.

Solution:

  1. Call init on newly created object
  2. Proactively fix this for all types of settings objects

This change addresses #1951

Editing FrequencyScanner via api fails due to null pointer.
Failure happens when swagger generated setValue method is called for
complicated/nested structure on the object with is created by
constructor, but not initialized by the ::init method.

Solution:
1. Call init on newly created object
2. Proactively fix this for all types of settings objects
channelSettings->getFreeDvModSettings()->fromJsonObject(settingsJsonObject);
}
else if (channelSettingsKey == "FreqScannerSettings")
{
channelSettings->setFreqScannerSettings(new SWGSDRangel::SWGFreqScannerSettings());
channelSettings->getFreqScannerSettings()->init();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the problem itself.
Rest of changes are proactively doing the same for the rest of types, to avoid somebody getting into the same trouble

@f4exb f4exb merged commit 9ce5653 into f4exb:master Jan 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants