Merge "Harden against invalid paths." into pi-dev
am: b9596e5feb

Change-Id: Ic2648e92714b922d55ca4f7493a80a48a1d17c35