Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
ebbeed78
Kaydet (Commit)
ebbeed78
authored
Ara 19, 2006
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1484695: The tarfile module now raises a HeaderError exception
if a buffer given to frombuf() is invalid.
üst
8183c635
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
libtarfile.tex
Doc/lib/libtarfile.tex
+7
-0
tarfile.py
Lib/tarfile.py
+17
-10
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/lib/libtarfile.tex
Dosyayı görüntüle @
ebbeed78
...
...
@@ -124,6 +124,11 @@ Some facts and figures:
only if
\member
{
TarFile.errorlevel
}
\code
{
== 2
}
.
\end{excdesc}
\begin{excdesc}
{
HeaderError
}
Is raised by
\method
{
frombuf()
}
if the buffer it gets is invalid.
\versionadded
{
2.6
}
\end{excdesc}
\begin{seealso}
\seemodule
{
zipfile
}{
Documentation of the
\refmodule
{
zipfile
}
standard module.
}
...
...
@@ -332,6 +337,8 @@ the file's data itself.
\begin{methoddesc}
{
frombuf
}{}
Create and return a
\class
{
TarInfo
}
object from a string buffer.
\versionadded
[Raises
\exception
{
HeaderError
}
if the buffer is
invalid.]
{
2.6
}
\end{methoddesc}
\begin{methoddesc}
{
tobuf
}{
posix
}
...
...
Lib/tarfile.py
Dosyayı görüntüle @
ebbeed78
...
...
@@ -280,6 +280,9 @@ class CompressionError(TarError):
class
StreamError
(
TarError
):
"""Exception for unsupported operations on stream-like TarFiles."""
pass
class
HeaderError
(
TarError
):
"""Exception for invalid headers."""
pass
#---------------------------
# internal stream interface
...
...
@@ -819,9 +822,17 @@ class TarInfo(object):
"""Construct a TarInfo object from a 512 byte string buffer.
"""
if
len
(
buf
)
!=
BLOCKSIZE
:
raise
Value
Error
(
"truncated header"
)
raise
Header
Error
(
"truncated header"
)
if
buf
.
count
(
NUL
)
==
BLOCKSIZE
:
raise
ValueError
(
"empty header"
)
raise
HeaderError
(
"empty header"
)
try
:
chksum
=
nti
(
buf
[
148
:
156
])
except
ValueError
:
raise
HeaderError
(
"invalid header"
)
if
chksum
not
in
calc_chksums
(
buf
):
raise
HeaderError
(
"bad checksum"
)
tarinfo
=
cls
()
tarinfo
.
buf
=
buf
...
...
@@ -831,7 +842,7 @@ class TarInfo(object):
tarinfo
.
gid
=
nti
(
buf
[
116
:
124
])
tarinfo
.
size
=
nti
(
buf
[
124
:
136
])
tarinfo
.
mtime
=
nti
(
buf
[
136
:
148
])
tarinfo
.
chksum
=
nti
(
buf
[
148
:
156
])
tarinfo
.
chksum
=
chksum
tarinfo
.
type
=
buf
[
156
:
157
]
tarinfo
.
linkname
=
buf
[
157
:
257
]
.
rstrip
(
NUL
)
tarinfo
.
uname
=
buf
[
265
:
297
]
.
rstrip
(
NUL
)
...
...
@@ -843,8 +854,6 @@ class TarInfo(object):
if
prefix
and
not
tarinfo
.
issparse
():
tarinfo
.
name
=
prefix
+
"/"
+
tarinfo
.
name
if
tarinfo
.
chksum
not
in
calc_chksums
(
buf
):
raise
ValueError
(
"invalid header"
)
return
tarinfo
def
tobuf
(
self
,
posix
=
False
):
...
...
@@ -1793,16 +1802,14 @@ class TarFile(object):
tarinfo
=
self
.
proc_member
(
tarinfo
)
except
Value
Error
,
e
:
except
Header
Error
,
e
:
if
self
.
ignore_zeros
:
self
.
_dbg
(
2
,
"0x
%
X: empty or invalid block:
%
s"
%
(
self
.
offset
,
e
))
self
.
_dbg
(
2
,
"0x
%
X:
%
s"
%
(
self
.
offset
,
e
))
self
.
offset
+=
BLOCKSIZE
continue
else
:
if
self
.
offset
==
0
:
raise
ReadError
(
"empty, unreadable or compressed "
"file:
%
s"
%
e
)
raise
ReadError
(
str
(
e
))
return
None
break
...
...
Misc/NEWS
Dosyayı görüntüle @
ebbeed78
...
...
@@ -101,6 +101,9 @@ Core and builtins
Library
-------
- Patch #1484695: The tarfile module now raises a HeaderError exception
if a buffer given to frombuf() is invalid.
- Bug #1503765: Fix a problem in logging.config with spaces in comma-
separated lists read from logging config files.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment