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

Bounds checking issue in stream args #534

Closed
guruofquality opened this issue Apr 2, 2017 · 2 comments
Closed

Bounds checking issue in stream args #534

guruofquality opened this issue Apr 2, 2017 · 2 comments
Assignees

Comments

@guruofquality
Copy link

Due to unspecified default when using a list of options, we got an index that was outside of the options size and a segfault. I'm fixing the issue in the LimeSuite, but just a note in case you want to do bounds checking here, get a warning, or safely pick element 0, rather than now it can bomb out:

@cjcliffe cjcliffe added the bug label Apr 20, 2017
@cjcliffe cjcliffe self-assigned this Apr 20, 2017
@vsonnier
Copy link
Collaborator

vsonnier commented Aug 14, 2017

Right, since the master is no longer the master I reproduced the original code here:

 if (dev) {
            args = dev->getSoapyDevice()->getStreamArgsInfo(SOAPY_SDR_RX, 0);
            
            if (args.size()) {
                for (args_i = args.begin(); args_i != args.end(); args_i++) {
                    SoapySDR::ArgInfo arg = (*args_i);
                    wxPGProperty *prop = streamProps[arg.key];
            
                    if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
                        streamArgs[arg.key] = arg.options[prop->GetChoiceSelection()]; // <<<<< HERE.
                    } else if (arg.type == SoapySDR::ArgInfo::BOOL) {
                        streamArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false";
                    } else {
                        streamArgs[arg.key] = prop->GetValueAsString();
                    }
                }
            }
        }

@vsonnier
Copy link
Collaborator

This is the same as the #634, so close this old one as duplicate.

tgunr added a commit to tgunr/CubicSDR that referenced this issue Mar 21, 2018
* 'master' of https://github.com/cjcliffe/CubicSDR:
  Fix cjcliffe#634 plus cjcliffe#534: bound checking in SDRDevices dialog selection
  Fixes for cjcliffe#635, round 1: BookmarkView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants