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

Garbage in debug output #172

Open
darkdarkdragon opened this issue Jan 30, 2020 · 0 comments
Open

Garbage in debug output #172

darkdarkdragon opened this issue Jan 30, 2020 · 0 comments

Comments

@darkdarkdragon
Copy link
Contributor

When there is not enough video memory, often garbage can be seen in debug output, like this:

[h264_nvenc @ 0x7f9f50e48f40] InitializeEncoder failed: out of memory (10): R,̒z	�H��D��
                                                                                       I��̀��K)4?�??��:��Ȃt��
                                                                                                            ��>�ٿ�z��{�J��1�
Error opening video encoder

It is produced in this function:

static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err,
                             const char *error_string)
{
    const char *desc;
    const char *details = "(no details)";
    int ret = nvenc_map_error(err, &desc);

#ifdef NVENC_HAVE_GETLASTERRORSTRING
    NvencContext *ctx = avctx->priv_data;
    NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs;

    if (p_nvenc && ctx->nvencoder)
        details = p_nvenc->nvEncGetLastErrorString(ctx->nvencoder);
#endif

    av_log(avctx, AV_LOG_ERROR, "%s: %s (%d): %s\n", error_string, desc, err, details);

    return ret;
}

Garbage is the pointer returned by nvEncGetLastErrorString function.
It looks like nvEncGetLastErrorString is not thread safe.
Potentially this could be vulnerability.
Given that use of this function is guarded by NVENC_HAVE_GETLASTERRORSTRING define, I think we should undefine it at configuration stage to disable it usage.

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

No branches or pull requests

1 participant