whitelist floats with exponents in YAML

fixes CNVS-26342

test plan:
 * have a quiz submission with an absurdly small score (like 1e-15);
   I have no idea how to produce this
 * loading speedgrader for that quiz should work

Change-Id: Icc7a73ab61d2517661824b828fb2a73f115a097e
Reviewed-on: https://gerrit.instructure.com/70024
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2016-01-11 10:01:32 -07:00
parent 8a53495af9
commit 6b773c0d43
2 changed files with 5 additions and 0 deletions

View File

@ -49,6 +49,7 @@ SafeYAML::OPTIONS.merge!(
whitelisted_tags: %w[
tag:ruby.yaml.org,2002:symbol
tag:yaml.org,2002:float
tag:yaml.org,2002:float#exp
tag:yaml.org,2002:str
tag:yaml.org,2002:timestamp
tag:yaml.org,2002:timestamp#iso8601

View File

@ -45,6 +45,7 @@ hwia: !map:HashWithIndifferentAccess
b: 2
float: !float
5.1
float_with_exp: -1.7763568394002505e-15
os: !ruby/object:OpenStruct
modifiable: true
table:
@ -105,6 +106,9 @@ YAML
float = verify(result, 'float', Float)
expect(float).to eq 5.1
float_with_exp = verify(result, 'float_with_exp', Float)
expect(float_with_exp).to eq(-1.7763568394002505e-15)
os = verify(result, 'os', OpenStruct)
expect(os.a).to eq 1
expect(os.b).to eq 2