Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
1ad220aa
Commit
1ad220aa
authored
Aug 24, 2009
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made is_blob_record much faster and more secure.
parent
f1c0df86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
src/ZODB/blob.py
src/ZODB/blob.py
+17
-6
No files found.
src/ZODB/blob.py
View file @
1ad220aa
...
...
@@ -15,6 +15,7 @@
"""
import
cPickle
import
cStringIO
import
base64
import
binascii
import
logging
...
...
@@ -934,6 +935,10 @@ else:
link_or_copy
=
os
.
link
def
find_global_Blob
(
module
,
class_
):
if
module
==
'ZODB.blob'
and
class_
==
'Blob'
:
return
Blob
def
is_blob_record
(
record
):
"""Check whether a database record is a blob record.
...
...
@@ -941,9 +946,15 @@ def is_blob_record(record):
storage to another.
"""
try
:
return
cPickle
.
loads
(
record
)
is
ZODB
.
blob
.
Blob
except
(
MemoryError
,
KeyboardInterrupt
,
SystemExit
):
raise
except
Exception
:
return
False
if
'ZODB.blob'
in
record
:
unpickler
=
cPickle
.
Unpickler
(
cStringIO
.
StringIO
(
record
))
unpickler
.
find_global
=
find_global_Blob
try
:
return
unpickler
.
load
()
is
Blob
except
(
MemoryError
,
KeyboardInterrupt
,
SystemExit
):
raise
except
Exception
:
pass
return
False
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