Apphost: Handle long paths while reading bundles (dotnet/core-setup#5948)
authorSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>
Sat, 20 Apr 2019 00:21:45 +0000 (17:21 -0700)
committerGitHub <noreply@github.com>
Sat, 20 Apr 2019 00:21:45 +0000 (17:21 -0700)
commit38fec020e710e7fb7dae77f13c6595b26132540c
tree7d0357614797858a538dc4702932abfa2e786ae0
parentaffae2fcaa0135616c80ee4531d2130e04ab29b2
Apphost: Handle long paths while reading bundles (dotnet/core-setup#5948)

Handle path-lengths larger than 127 bytes in:
- Bundle ID (also a component of the extraction path)
- relative-path (path of a file within the bundle)

The above strings are encoded as length prefixed strings by System.IO.BinaryWriter.Write()
The length itself is encoded as a series of bytes where
  - 7-bits contain length bits
  - 8th bit indicates whether there are more bytes to follow.

For a path, there can be a maximum of two bytes (max 4096)
This commit handles the case where a path length is long enough to be need two bytes.

Also added a test case.

Fixes dotnet/core-setup#5932

Commit migrated from https://github.com/dotnet/core-setup/commit/9889b387cff5086f09ef174c5e73c278d3dba208
src/installer/corehost/cli/apphost/bundle/bundle_runner.cpp
src/installer/corehost/cli/apphost/bundle/bundle_runner.h
src/installer/corehost/cli/apphost/bundle/file_entry.cpp
src/installer/corehost/cli/apphost/bundle/file_entry.h
src/installer/corehost/cli/apphost/bundle/manifest.cpp
src/installer/corehost/cli/apphost/bundle/manifest.h
src/installer/test/Assets/TestProjects/StandaloneAppWithSubDirs/Program.cs
src/installer/test/Assets/TestProjects/StandaloneAppWithSubDirs/Sentence/Noun/Pronoun/Another/word
src/installer/test/Assets/TestProjects/StandaloneAppWithSubDirs/Sentence/This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really long file name for punctuation/word [new file with mode: 0644]
src/installer/test/Assets/TestProjects/StandaloneAppWithSubDirs/StandaloneAppWithSubDirs.csproj