From a10e9de4847fdf0555eff6e760b37021f682b592 Mon Sep 17 00:00:00 2001 From: krocard Date: Thu, 21 Jan 2021 15:23:30 +0000 Subject: [PATCH] Check that cache dir exist Not checking it would force ExoPlayer to use the global tmp dir which would expose it to external file replacement attacks. This is a theoretical vulnerability as this code is only use in tests and cache dir always exist in the AOSP android implementation. PiperOrigin-RevId: 353013929 --- .../src/main/java/com/google/android/exoplayer2/util/Util.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java index 9783240ab3..648bdf96a2 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java @@ -2084,7 +2084,7 @@ public final class Util { /** Creates a new empty file in the directory returned by {@link Context#getCacheDir()}. */ public static File createTempFile(Context context, String prefix) throws IOException { - return File.createTempFile(prefix, null, context.getCacheDir()); + return File.createTempFile(prefix, null, checkNotNull(context.getCacheDir())); } /**