Index: pkg/compiler/lib/src/apiimpl.dart |
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart |
index f8695bba1a20c7753c52781d8779c343dd1e4c7a..a2c7d8c9a957ded550c1991ec264f4199629e78d 100644 |
--- a/pkg/compiler/lib/src/apiimpl.dart |
+++ b/pkg/compiler/lib/src/apiimpl.dart |
@@ -392,6 +392,13 @@ class Compiler extends leg.Compiler { |
if (packageConfigContents is String) { |
packageConfigContents = UTF8.encode(packageConfigContents); |
} |
+ // The input provider may put a trailing 0 byte when it reads a source |
+ // file, which confuses the package config parser. |
+ if (packageConfigContents.length > 0 |
+ && packageConfigContents.last == 0) { |
+ packageConfigContents = packageConfigContents.sublist( |
+ 0, packageConfigContents.length - 1); |
+ } |
packages = |
new MapPackages(pkgs.parse(packageConfigContents, packageConfig)); |
}); |