PDB title: include space and ensure \x00 is the last character.

This commit is contained in:
John Schember 2009-06-28 18:50:16 -04:00
parent b975eb135c
commit 6a88e685de

View File

@ -30,7 +30,7 @@ class PdbHeaderReader(object):
def name(self): def name(self):
self.stream.seek(0) self.stream.seek(0)
return re.sub('[^-A-Za-z0-9]+', '', self.stream.read(32).replace('\x00', '')) return re.sub('[^-A-Za-z0-9 ]+', '', self.stream.read(32).replace('\x00', ''))
def full_section_info(self, number): def full_section_info(self, number):
if number not in range(0, self.num_sections): if number not in range(0, self.num_sections):
@ -66,7 +66,7 @@ class PdbHeaderBuilder(object):
def __init__(self, identity, title): def __init__(self, identity, title):
self.identity = identity.ljust(3, '\x00')[:8] self.identity = identity.ljust(3, '\x00')[:8]
self.title = re.sub('[^-A-Za-z0-9]+', '_', title).ljust(32, '\x00')[:32].encode('ascii', 'replace') self.title = '%s\x00' % re.sub('[^-A-Za-z0-9 ]+', '_', title).ljust(31, '\x00')[:31].encode('ascii', 'replace')
def build_header(self, section_lengths, out_stream): def build_header(self, section_lengths, out_stream):
''' '''