Issue 28591: imghdr doesn't recognize some jpeg formats (original) (raw)

Issue28591

process

Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: 4simple-org, Claudiu.Popa, ezio.melotti, intgr, iritkatriel, jcea, joril, kovid, mvignali, r.david.murray, vstinner, xiang.zhang
Priority: normal Keywords: patch

Created on 2016-11-02 20:06 by 4simple-org, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
1.jpg 4simple-org,2016-11-02 20:06
2.jpg 4simple-org,2016-11-02 20:10
imghdr27.patch 4simple-org,2016-11-02 21:02 patch for python 2.7
imghdr35.patch 4simple-org,2016-11-02 21:05 patch for python 3.X
imghdr_py27.py 4simple-org,2016-11-02 21:07 Working imghdr lib for python 2.7.X
imghdr_py3.py 4simple-org,2016-11-02 21:08 Working imghdr lib for python 3.X
imghdr_py3.patch 4simple-org,2016-11-10 21:32 New patch for imghdr bug, including unittets. This patch works on python 3.x review
python1.jpg 4simple-org,2016-11-10 21:35 Image used in the unit-tests of previous patch.
imghdr_py27.patch 4simple-org,2016-11-10 23:13 New patch for imghdr bug, including unittets. This patch works on python 2.7 review
Messages (15)
msg279940 - (view) Author: Raul (4simple-org) Date: 2016-11-02 20:06
Some valid JPEG images are not detected by the imghdr lib.
msg279941 - (view) Author: Raul (4simple-org) Date: 2016-11-02 20:10
Other valid jpeg image not detected.
msg279946 - (view) Author: Raul (4simple-org) Date: 2016-11-02 21:02
patch for python 2.7
msg279947 - (view) Author: Raul (4simple-org) Date: 2016-11-02 21:03
patch for python 3.X
msg279948 - (view) Author: Raul (4simple-org) Date: 2016-11-02 21:05
patch for python 3.X
msg279949 - (view) Author: Raul (4simple-org) Date: 2016-11-02 21:07
Working imghdr lib for python 2.7.X
msg279950 - (view) Author: Raul (4simple-org) Date: 2016-11-02 21:08
Working imghdr lib for python 3.X
msg279952 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-11-02 21:40
There seem to be unrelated changes in your patches, and we'll want tests as well before committing. See also issue 16512 and the issues linked from it. (I haven't reviewed to see if there is any overlap.)
msg279963 - (view) Author: Kovid Goyal (kovid) Date: 2016-11-03 04:06
FYI, the uptodate version of imghdr I maintain is here: https://github.com/kovidgoyal/calibre/blob/master/src/calibre/utils/imghdr.py It uses memoryview for performance and can also also read image sizes from file headers for jpeg, png, gif and jpeg2000. Note that is is only tested on python 2.7 I'm afraid I dont have the time to shepherd it through your review process, but feel free to take code from it if you want to. It is licensed GPLv3 but I am willing to re-license to another license if needed, as I am the sole contributor.
msg279965 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-11-03 05:02
There is also #27121 reporting similar problem.
msg280544 - (view) Author: Raul (4simple-org) Date: 2016-11-10 21:32
New patch for imghdr bug, including unittets. This patch works on python 3.x
msg280545 - (view) Author: Raul (4simple-org) Date: 2016-11-10 21:35
Image used in the unit-tests of previous patch. Add it under Lib/test/imghdrdata/python1.jpg
msg280546 - (view) Author: Raul (4simple-org) Date: 2016-11-10 21:37
The don't solve the problem, note how the patch it provide fails to detect all the valid JPEG images attached in this issue.
msg280550 - (view) Author: Raul (4simple-org) Date: 2016-11-10 23:13
New patch for imghdr bug, including unittets. This patch works on python 2.7
msg415044 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-13 17:12
imghdr is deprecated as per PEP 594, so there won't be further enhancements to it.
History
Date User Action Args
2022-04-11 14:58:39 admin set github: 72777
2022-03-13 17:12:37 iritkatriel set status: open -> closednosy: + iritkatrielmessages: + resolution: wont fixstage: resolved
2016-11-10 23:13:37 4simple-org set files: + imghdr_py27.patchmessages: +
2016-11-10 21:37:41 4simple-org set messages: +
2016-11-10 21:35:27 4simple-org set files: + python1.jpgmessages: +
2016-11-10 21:32:26 4simple-org set files: + imghdr_py3.patchmessages: +
2016-11-03 05:02:25 xiang.zhang set nosy: + xiang.zhangmessages: + versions: - Python 3.3, Python 3.4
2016-11-03 04:06:09 kovid set messages: +
2016-11-02 21:40:45 r.david.murray set messages: +
2016-11-02 21:08:26 4simple-org set files: + imghdr_py3.pymessages: +
2016-11-02 21:07:43 4simple-org set files: + imghdr_py27.pymessages: +
2016-11-02 21:05:11 4simple-org set files: + imghdr35.patchmessages: +
2016-11-02 21:03:53 4simple-org set files: - imghdr35.py
2016-11-02 21:03:11 4simple-org set files: + imghdr35.pymessages: +
2016-11-02 21:02:37 4simple-org set files: + imghdr27.patchkeywords: + patchmessages: +
2016-11-02 20:10:14 4simple-org set files: + 2.jpgmessages: +
2016-11-02 20:06:18 4simple-org create