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
This commit is contained in:
krocard 2021-01-21 15:23:30 +00:00 committed by kim-vde
parent d1faf713af
commit a10e9de484

View file

@ -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()));
}
/**