mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
PDB Input: Ingore malformed metadata records. Fixes #1499878 [Plucker pdb files fail to load](https://bugs.launchpad.net/calibre/+bug/1499878)
This commit is contained in:
parent
648b73541a
commit
ffff07bdd3
@ -44,8 +44,10 @@ def get_metadata(stream, extract_cover=True):
|
||||
author = None
|
||||
pubdate = 0
|
||||
for i in xrange(record_count):
|
||||
type, = struct.unpack('>H', section_data[2+adv:4+adv])
|
||||
length, = struct.unpack('>H', section_data[4+adv:6+adv])
|
||||
try:
|
||||
type, length = struct.unpack_from('>HH', section_data, 2 + adv)
|
||||
except struct.error:
|
||||
break
|
||||
|
||||
# CharSet
|
||||
if type == 1:
|
||||
|
@ -199,8 +199,10 @@ class SectionMetadata(object):
|
||||
|
||||
adv = 0
|
||||
for i in xrange(record_count):
|
||||
type, = struct.unpack('>H', raw[2+adv:4+adv])
|
||||
length, = struct.unpack('>H', raw[4+adv:6+adv])
|
||||
try:
|
||||
type, length = struct.unpack_from('>HH', raw, 2 + adv)
|
||||
except struct.error:
|
||||
break
|
||||
|
||||
# CharSet
|
||||
if type == 1:
|
||||
|
Loading…
x
Reference in New Issue
Block a user