Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover from a broken Cn #1

Closed
wants to merge 1 commit into from
Closed

Recover from a broken Cn #1

wants to merge 1 commit into from

Conversation

gitfoxi
Copy link

@gitfoxi gitfoxi commented Aug 19, 2014

This works around someone else's bug where they write a Cn that is longer than 255 bytes. They actually write the long string but the U1 with the length overflows to some smaller number. Since the parser actually does the read operations, some data from the record is left unread and subsequent reads see garbage.

I think a better approach is to read each record's REC_LEN bytes first and have the parsers work on that data but the parser is very complicated and I wouldn't know where to begin making that change.

@cmars
Copy link
Owner

cmars commented Aug 22, 2014

Thanks for this. Will try to get to this early next week, I've been quite busy.

@ghost
Copy link

ghost commented Jun 8, 2018

@cmars are you still working on this pull requests?

@@ -160,6 +160,10 @@ def parse_records(self, count=0):
if len(fields) < len(recType.columnNames):
fields += [None] * (len(recType.columnNames) - len(fields))
self.send((recType, fields))
if header.len > 0:
print >> sys.stderr, "Warning: Broken header. Unprocessed data left in", recType.__class__.__name__, "record. Working around it."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be updated to python 3.

florisla added a commit to florisla/pystdf that referenced this pull request Jul 12, 2018
Commit fbab53aa19d1aea43ff3ab2ace15058945f2e49 from cmars#1 ported to Python 3.
cmars pushed a commit that referenced this pull request Aug 26, 2019
@cmars
Copy link
Owner

cmars commented Jul 22, 2023

Replaced by #11

@cmars cmars closed this Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants