[SR-6078] crashes with nested throwing values in JSON/PList Encoder #48633
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 1065e421ab735e38aa8c528f5e90c69c
relates to:
Issue Description:
Referencing encoder deallocated with multiple containers on stack.
when a value throws before
storage.popContainer()
is called, the storage will not remove the last beforedeinit
. Need to pop the value if a value was pushed (inbox_
andbox(Date or Data)
(same applies for JSONclosure(Date or Data, self)
strategies)).example (in box_) :
if encode throws here, the value is not removed
(checks for depth count)
where this will crash:
(
Array
is first to call super encoder,Test
is second to add to storage, andArray<Float>
adds the second value to storage and throws)[[[Float.infinity]]]
callssuperEncoder()
before storage count goes above 1 so it gets around this. Found a good solution if anyone is working on this. Example:The text was updated successfully, but these errors were encountered: