[YAML] Fix undefined behavior.
[test] Fix tests on Windows.