Skip to content

avoid potential null deref in as_cpp #26

@kevinushey

Description

@kevinushey

Looking here:

if (Rf_isString(from)) {
if (Rf_xlength(from) == 1) {
const char* c_p = nullptr;
unwind_protect([&] { c_p = Rf_translateCharUTF8(STRING_ELT(from, 0)); });
return c_p[0];
}
}

If an error occurs during translation, c_p will remain as a nullptr and then the attempt to access the zero-th element will likely crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions