Skip to content

Incorrect lifetime of error strings when awslc or boringssl features are enabled #2470

@kornelski

Description

@kornelski

rust-openssl assumes that borrowed error data is 'static and not free()'d by the underlying library:

https://github.com/sfackler/rust-openssl/blob/01166fa74c5d398feb5fbf1914a9188869ddabc2/openssl/src/error.rs#L169

However, this isn't the case in boringssl and aws-lc. They have a workaround that explicitly calls out rust-openssl as having a wrong assumption here:

https://github.com/google/boringssl/blob/480148ccc9444f5323b84389a6660e33ae38d4cb/crypto/err/err.cc#L184-L187

https://github.com/aws/aws-lc/blob/f4f0be9fc1a894121c56a2a3b06b043f15465249/crypto/err/err.c#L293-L296

Unfortunately, the workaround has been broken by additions in c3b714e

and now malloced strings from boringssl and aws-lc are treated again as 'static, which is incorrect:

https://github.com/sfackler/rust-openssl/blob/01166fa74c5d398feb5fbf1914a9188869ddabc2/openssl/src/error.rs#L136-L138

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