Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Do not leave UniValue object in broken state when read(..) fails #39

Closed
wants to merge 1 commit into from

Conversation

awemany
Copy link

@awemany awemany commented May 26, 2017

This prevents the creation of broken UniValue objects when returning
from read().

Objects that e.g. have .keys and .values of different size might be
created, which would then trigger an exception when serialized.

This prevents the creation of broken UniValue objects when returning
from read().

Objects that e.g. have .keys and .values of different size might be
created, which would then trigger an exception when serialized.
@jgarzik
Copy link
Owner

jgarzik commented Sep 24, 2017

  1. Should use clear() to be consistent with the rest of the function (notably the first line).

  2. Consider using goto as a special case to provide a single unwind error path: https://softwareengineering.stackexchange.com/a/154980

jgarzik added a commit that referenced this pull request Feb 3, 2019
Avoid parsing edge cases that leave the class internal data in an
inconsistent state, when the parser encounters an input data error.

This is a rewrite of PR #39 by @awemany.
@jgarzik
Copy link
Owner

jgarzik commented Feb 3, 2019

Superceded by #58

@jgarzik jgarzik closed this Feb 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants