Issue 16859: tarfile.TarInfo.fromtarfile does not check read() return value (original) (raw)

Issue16859

Created on 2013-01-04 07:55 by socketpair, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg179006 - (view) Author: Марк Коренберг (socketpair) * Date: 2013-01-04 07:55
tarfile.TarInfo.fromtarfile does not check read() return value. read() may return less than requested size, so, buf = tarfile.fileobj.read(BLOCKSIZE) ... obj.offset = tarfile.fileobj.tell() - BLOCKSIZE may do something nasty.
msg223125 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-15 17:20
@Lars can we have a comment on this please.
msg223412 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2014-07-18 14:30
The size of the buffer returned by TarInfo.fromtarfile() is checked by TarInfo.frombuf() which raises either an EmptyHeaderError or TruncatedHeaderError respectively.
History
Date User Action Args
2022-04-11 14:57:40 admin set github: 61063
2014-07-18 14:30:48 lars.gustaebel set status: open -> closedmessages: + assignee: lars.gustaebelresolution: not a bugstage: resolved
2014-07-15 17:20:30 BreamoreBoy set versions: + Python 2.7, Python 3.4, Python 3.5nosy: + BreamoreBoymessages: + type: behavior
2013-01-04 08:07:58 ned.deily set nosy: + lars.gustaebel
2013-01-04 07:55:22 socketpair create