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

_PyImport_GetDynLoadFunc() doesn't check return value of fstat() #60096

Closed
tiran opened this issue Sep 9, 2012 · 4 comments
Closed

_PyImport_GetDynLoadFunc() doesn't check return value of fstat() #60096

tiran opened this issue Sep 9, 2012 · 4 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@tiran
Copy link
Member

tiran commented Sep 9, 2012

BPO 15892
Nosy @jcea, @vstinner, @tiran, @ericsnowcurrently

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2013-07-26.20:47:56.109>
created_at = <Date 2012-09-09.21:56:02.273>
labels = ['interpreter-core', 'type-bug']
title = "_PyImport_GetDynLoadFunc() doesn't check return value of fstat()"
updated_at = <Date 2013-07-26.20:51:00.430>
user = 'https://github.com/tiran'

bugs.python.org fields:

activity = <Date 2013-07-26.20:51:00.430>
actor = 'christian.heimes'
assignee = 'none'
closed = True
closed_date = <Date 2013-07-26.20:47:56.109>
closer = 'christian.heimes'
components = ['Interpreter Core']
creation = <Date 2012-09-09.21:56:02.273>
creator = 'christian.heimes'
dependencies = []
files = []
hgrepos = []
issue_num = 15892
keywords = []
message_count = 4.0
messages = ['170138', '193745', '193747', '193749']
nosy_count = 4.0
nosy_names = ['jcea', 'vstinner', 'christian.heimes', 'eric.snow']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue15892'
versions = ['Python 2.7', 'Python 3.2', 'Python 3.3', 'Python 3.4']

@tiran
Copy link
Member Author

tiran commented Sep 9, 2012

The function _PyImport_GetDynLoadFunc() in Python/dynload_shlib.c doesn't check the return value of fstat()

CID 486250: Other violation (CHECKED_RETURN)At (3): Calling function "fstat(fileno(fp), &statb)" without checking return value. This library function may fail and return an error code.
At (4): No check of the return value of "fstat(fileno(fp), &statb)".
93 fstat(fileno(fp), &statb);

Suggested fix:
if (fstat(fileno(fp), &statb) == -1) {
    PyErr_SetFromErrnoWithFilename(PyExc_IOError, pathname);
    return NULL;
}
}

@tiran tiran added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Sep 9, 2012
@tiran
Copy link
Member Author

tiran commented Jul 26, 2013

Already fixed

@tiran tiran closed this as completed Jul 26, 2013
@vstinner
Copy link
Member

changeset: 84741:654268ff29b5
branch: 3.3
parent: 84736:ce771c2d0220
user: Christian Heimes <christian@cheimes.de>
date: Sat Jul 20 22:17:55 2013 +0200
files: Python/dynload_shlib.c
description:
Check return value of fstat() in _PyImport_GetDynLoadFunc()
CID 486250

@tiran
Copy link
Member Author

tiran commented Jul 26, 2013

I wonder why I did not mention the issue # in the checkin message... Thanks :)

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants