Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unreachable code inModules/_ssl.c #106831

Closed
Closed
Assignees
sobolevn
Labels
topic-SSLtype-bugAn unexpected behavior, bug, or error
@sobolevn

Description

@sobolevn

Looks like code in this check cannot ever be reached:

cpython/Modules/_ssl.c

Lines 2824 to 2827 in2b94a05

newsession=d2i_SSL_SESSION(NULL,&const_p,slen);
if (session==NULL) {
gotoerror;
}

At this pointsession cannot beNULL, because it is checked right above:

cpython/Modules/_ssl.c

Lines 2803 to 2806 in2b94a05

if (session==NULL) {
PyErr_SetString(PyExc_ValueError,"Invalid session");
gotoerror;
}

I guess that it was intended to checknewsession variable instead.

Docs say:https://www.openssl.org/docs/man1.0.2/man3/d2i_SSL_SESSION.html

d2i_SSL_SESSION() returns a pointer to the newly allocated SSL_SESSION object. In case of failure the NULL-pointer is returned and the error message can be retrieved from the error stack.

One more thing that bothers me here is that error is not set. We just returnNULL which can theoretically crash the interpeter.

So, my plan is to:

  1. Checknewsession instead
  2. Add aValueError there

Originally introduced in99a6570

PR is on its way.

Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.

Author A. Voronin.

Linked PRs

Metadata

Metadata

Assignees

Labels

topic-SSLtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp