Skip to content

Commit 1aecb65

Browse files
harryterkelsenwhesse
authored andcommitted
dart2js: remove trailing 0 byte when reading .packages
BUG= [email protected] Review URL: https://codereview.chromium.org//1290643007.
1 parent 7f78948 commit 1aecb65

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/compiler/lib/src/apiimpl.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@ class Compiler extends leg.Compiler {
379379
if (packageConfigContents is String) {
380380
packageConfigContents = UTF8.encode(packageConfigContents);
381381
}
382+
// The input provider may put a trailing 0 byte when it reads a source
383+
// file, which confuses the package config parser.
384+
if (packageConfigContents.length > 0
385+
&& packageConfigContents.last == 0) {
386+
packageConfigContents = packageConfigContents.sublist(
387+
0, packageConfigContents.length - 1);
388+
}
382389
packages =
383390
new MapPackages(pkgs.parse(packageConfigContents, packageConfig));
384391
});

0 commit comments

Comments
 (0)