Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodb
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
zodb
Commits
b08a6d01
Commit
b08a6d01
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
3024d0f8
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 @
b08a6d01
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
"""
"""
import
cPickle
import
cPickle
import
cStringIO
import
base64
import
base64
import
binascii
import
binascii
import
logging
import
logging
...
@@ -934,6 +935,10 @@ else:
...
@@ -934,6 +935,10 @@ else:
link_or_copy
=
os
.
link
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
):
def
is_blob_record
(
record
):
"""Check whether a database record is a blob record.
"""Check whether a database record is a blob record.
...
@@ -941,9 +946,15 @@ def is_blob_record(record):
...
@@ -941,9 +946,15 @@ def is_blob_record(record):
storage to another.
storage to another.
"""
"""
try
:
if
'ZODB.blob'
in
record
:
return
cPickle
.
loads
(
record
)
is
ZODB
.
blob
.
Blob
unpickler
=
cPickle
.
Unpickler
(
cStringIO
.
StringIO
(
record
))
except
(
MemoryError
,
KeyboardInterrupt
,
SystemExit
):
unpickler
.
find_global
=
find_global_Blob
raise
except
Exception
:
try
:
return
False
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