File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
compiler/src/dotty/tools/dotc/core/tasty
tasty/src/dotty/tools/tasty Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ object AttributePickler:
18
18
for attribute <- attributes do
19
19
val bytes = attribute.getBytes(StandardCharsets .UTF_8 ).nn
20
20
val length = bytes.length
21
+ assert(" [a-zA-Z0-9]+" .r.matches(attribute), s " Malformed attribute: $attribute\n . Attribute must match [a-zA-Z0-9]+ " )
21
22
buf.writeNat(length)
22
23
buf.writeBytes(bytes, length)
23
24
end pickleAttributes
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ class AttributeUnpickler(reader: TastyReader):
16
16
val length = readNat()
17
17
val bytes = readBytes(length)
18
18
val attribute = new String (bytes, StandardCharsets .UTF_8 )
19
+ assert(" [a-zA-Z0-9]+" .r.matches(attribute), s " Malformed attribute: $attribute\n . Attribute must match [a-zA-Z0-9]+ " )
19
20
attributesBuilder += attribute
20
21
}
21
22
attributesBuilder.result()
Original file line number Diff line number Diff line change @@ -265,10 +265,13 @@ All elements of a position section are serialized as Ints
265
265
266
266
Standard Section: "Comments" Comment*
267
267
```none
268
- Comment = Length Bytes LongInt // Raw comment's bytes encoded as UTF-8, followed by the comment's coordinates.
268
+ Comment = UTF8 LongInt // Raw comment's bytes encoded as UTF-8, followed by the comment's coordinates.
269
269
```
270
270
271
- Standard Section: "Attributes" UTF8*
271
+ Standard Section: "Attributes" Attribute*
272
+ ```none
273
+ Attribute = UTF8 // attributes match the regex [a-zA-Z0-9]+
274
+ ```
272
275
273
276
**************************************************************************************/
274
277
You can’t perform that action at this time.
0 commit comments