зеркало из https://github.com/github/codeql.git
JavaScript: Fix potential null-pointer exception in YAML extractor.
`ScalarEvent.getStyle()` is documented as returning `null` for plain scalars, so we need to handle that specially (cf https://github.com/Semmle/ql/blob/master/javascript/ql/src/semmle/javascript/YAML.qll#L100 for the corresponding code in the library, which expects plain style to be encoded as zero).
This commit is contained in:
Родитель
6885b5cf1f
Коммит
a417884173
|
@ -166,8 +166,10 @@ public class YAMLExtractor implements IExtractor {
|
|||
NodeId.scalar,
|
||||
scalar.getValue(),
|
||||
scalar.getImplicit().canOmitTagInPlainScalar());
|
||||
Character style = scalar.getStyle();
|
||||
int styleCode = style == null ? 0 : (int) style;
|
||||
trapWriter.addTuple(
|
||||
YAMLTables.YAML_SCALARS, label, (int) scalar.getStyle(), scalar.getValue());
|
||||
YAMLTables.YAML_SCALARS, label, styleCode, scalar.getValue());
|
||||
} else if (start.is(Event.ID.SequenceStart)) {
|
||||
kind = NodeKind.SEQUENCE;
|
||||
SequenceStartEvent sequenceStart = (SequenceStartEvent) start;
|
||||
|
|
Загрузка…
Ссылка в новой задаче