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

Fixed segfault if chip was not found in chip config files #1166

Merged
merged 1 commit into from
Aug 1, 2021
Merged

Fixed segfault if chip was not found in chip config files #1166

merged 1 commit into from
Aug 1, 2021

Commits on Jul 28, 2021

  1. Do not segfault if cannot find chip in config files

    stlink_chipid_get_params() used to segfault on memcmp() when
    struct stlink_chipid_params *params was NULL. This could happen if
    either:
    - there were no chip config files (*.chip), or
    - process_chipfile() failed to parse chip_id from the chip config files.
    The latter case is caused by the usage of atoi() to parse the chip id.
    Since the chip id is stored in hex, atoi() returns 0; such id cannot be
    matched to any actual chip.
    
    The segfault occurs on commit a52e1bc,
    in file src/stlink-lib/chipid.c:957
    (https://github.com/stlink-org/stlink/blob/a52e1bc5489e23f3c1071c6912820efacaa3b22c/src/stlink-lib/chipid.c#L957).
    
    Check if params is NULL, in such case, set it to p2, which should not be
    NULL as long as struct stlink_chipid_params devices[] exists.
    
    May fix (workaround) #1163.
    gszy committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    1dd94a1 View commit details
    Browse the repository at this point in the history