Issue 3954: _hotshot: invalid error control in logreader() (original) (raw)

Created on 2008-09-24 10:02 by vstinner, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
_hotshot_logreader2.patch vstinner,2008-09-24 10:10 Fixed patch + unit test for this issue
Messages (8)
msg73700 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-09-24 10:02
Using Fusil the fuzzer, I found a "minor" bug in _hotshot module: it doesn't check correctly the errors in hotshot_logreader(). On error, an exception is raised (eg. by eof_error()) but the result is a pointer to a new allocated object instead of NULL. Here is a patch to delete the new created object (using Py_DECREF) and return NULL. It uses an ugly goto, but goto is sometimes useful to avoid code duplication on error handling (eg. see Linux source code). Example to reproduce the bug: --- import _hotshot, gc _hotshot.logreader(".") gc.collect() ---
msg73701 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-09-24 10:10
Oops, my previous patch always raise an error even on valid file :-p Here is a new patch with *an unit test* (yeah!).
msg73704 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-09-24 11:13
The patch is good to me. gotos are perfectly allowed for this purpose. (to python committers: Should this kind of "minor" issues be fixed after 2.6rc2? This could as well wait until 2.6.1)
msg73726 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-09-24 16:25
Looks fine. Since it is minor, why not commit it now?
msg73727 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-09-24 16:26
@georg: give me a svn access and i will commit it ;-)
msg73729 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-09-24 16:30
Regardless of the smiley, I certainly wouldn't object if you requested permissions on python-dev...
msg77641 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-12-11 23:16
> Regardless of the smiley, I certainly wouldn't object if you > requested permissions on python-dev... I still don't have an account and the issue is still open. 2.6(.1) and 3.0 are released. The patch has been reviewed by amaury.forgeotdarc, so can the patch be applied? The issue is still valid with python trunk: $ ./python Python 2.7a0 (trunk:67710M, Dec 11 2008, 23:57:18) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 >>> import _hotshot, gc >>> _hotshot.logreader(".") <_hotshot.LogReaderType object at 0xb7d936e0> >>> gc.collect() Exception EOFError: 'end of file with incomplete profile record' in 'garbage collection' ignored Fatal Python error: unexpected exception during garbage collection Abandon (core dumped)
msg77882 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-12-15 22:17
Fixed in r67797 (trunk) and r67801 (2.6) hotshot was removed from py3k.
History
Date User Action Args
2022-04-11 14:56:39 admin set github: 48204
2008-12-15 22:17:04 amaury.forgeotdarc set status: open -> closedresolution: accepted -> fixedmessages: +
2008-12-15 21:42:20 amaury.forgeotdarc set assignee: amaury.forgeotdarc
2008-12-11 23:16:05 vstinner set messages: +
2008-09-24 16:30:09 georg.brandl set messages: +
2008-09-24 16:26:46 vstinner set messages: +
2008-09-24 16:25:51 georg.brandl set nosy: + georg.brandlmessages: +
2008-09-24 11:13:18 amaury.forgeotdarc set resolution: acceptedmessages: + nosy: + amaury.forgeotdarc
2008-09-24 10:10:13 vstinner set files: - _hotshot_logreader.patch
2008-09-24 10:10:07 vstinner set files: + _hotshot_logreader2.patchmessages: +
2008-09-24 10:02:27 vstinner create