Exploit databaseDownload repository ZIP
GH-cd474985a1d611a2a689e02bc95daae0
satheesh575555/frameworks_base_aosp10_r33_cve-2022-20142
Sources for CVE-2022-20142
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files61
satheesh575555/frameworks_base_aosp10_r33_cve-2022-20142Revision 0b10dce4665c
- ↑..Parent directory
- dump/
- function/
- ArrayUtils.java
- AsyncChannel.java
- AsyncService.java
- BitUtils.java
- BitwiseInputStream.java
- BitwiseOutputStream.java
- CallbackRegistry.java
- CharSequences.java
- CollectionUtils.java
- ConcurrentUtils.java
- ContrastColorUtil.java
- DumpUtils.java
- EmergencyAffordanceManager.java
- ExponentiallyBucketedHistogram.java
- FastMath.java
- FastPrintWriter.java
- FastXmlSerializer.java
- FileRotator.java
- FunctionalUtils.java
- GrowingArrayUtils.java
- HexDump.java
- IState.java
- ImageUtils.java
- IndentingPrintWriter.java
- IntPair.java
- JournaledFile.java
- LatencyTracker.java
- LineBreakBufferedWriter.java
- LocalLog.java
- MemInfoReader.java
- MessageUtils.java
- MimeIconUtils.java
- NotificationMessagingUtil.java
- OWNERS
- ObjectUtils.java
- ParseUtils.java
- Preconditions.java
- ProcFileReader.java
- ProgressReporter.java
- Protocol.java
- ProviderAccessStats.java
- RingBuffer.java
- RingBufferIndices.java
- ScreenRecordHelper.java
- ScreenShapeHelper.java
- ScreenshotHelper.java
- SizedInputStream.java
- StatLogger.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
core/java/com/android/internal/util/MessageUtils.java
Java · 5,238 bytes/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.util;
import android.os.Message;
import android.util.Log;
import android.util.SparseArray;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
/**
* Static utility class for dealing with {@link Message} objects.
*/
public class MessageUtils {
private static final String TAG = MessageUtils.class.getSimpleName();
private static final boolean DBG = false;
/** Thrown when two different constants have the same value. */
public static class DuplicateConstantError extends Error {
private DuplicateConstantError() {}
public DuplicateConstantError(String name1, String name2, int value) {
super(String.format("Duplicate constant value: both %s and %s = %d",
name1, name2, value));
}
}
/**
* Finds the names of integer constants. Searches the specified {@code classes}, looking for
* accessible static integer fields whose names begin with one of the specified
* {@code prefixes}.
*
* @param classes the classes to examine.
* @param prefixes only consider fields names starting with one of these prefixes.
* @return a {@link SparseArray} mapping integer constants to their names.
*/
public static SparseArray<String> findMessageNames(Class[] classes, String[] prefixes) {
SparseArray<String> messageNames = new SparseArray<>();
for (Class c : classes) {
String className = c.getName();
if (DBG) Log.d(TAG, "Examining class " + className);
Field[] fields;
try {
fields = c.getDeclaredFields();
} catch (SecurityException e) {
Log.e(TAG, "Can't list fields of class " + className);
continue;
}
for (Field field : fields) {
int modifiers = field.getModifiers();
if (!Modifier.isStatic(modifiers) | !Modifier.isFinal(modifiers)) {
continue;
}
String name = field.getName();
for (String prefix : prefixes) {
// Does this look like a constant?
if (!name.startsWith(prefix)) {
continue;
}
try {
// TODO: can we have the caller try to access the field instead, so we don't
// expose constants it does not have access to?
field.setAccessible(true);
// Fetch the constant's value.
int value;
try {
value = field.getInt(null);
} catch (IllegalArgumentException | ExceptionInInitializerError e) {
// The field is not an integer (or short or byte), or c's static
// initializer failed and we have no idea what its value is.
// Either way, give up on this field.
break;
}
// Check for duplicate values.
String previousName = messageNames.get(value);
if (previousName != null && !previousName.equals(name)) {
throw new DuplicateConstantError(name, previousName, value);
}
messageNames.put(value, name);
if (DBG) {
Log.d(TAG, String.format("Found constant: %s.%s = %d",
className, name, value));
}
} catch (SecurityException | IllegalAccessException e) {
// Not allowed to make the field accessible, or no access. Ignore.
continue;
}
}
}
}
return messageNames;
}
/**
* Default prefixes for constants.
*/
public static final String[] DEFAULT_PREFIXES = {"CMD_", "EVENT_"};
/**
* Finds the names of integer constants. Searches the specified {@code classes}, looking for
* accessible static integer values whose names begin with {@link #DEFAULT_PREFIXES}.
*
* @param classNames the classes to examine.
* @return a {@link SparseArray} mapping integer constants to their names.
*/
public static SparseArray<String> findMessageNames(Class[] classNames) {
return findMessageNames(classNames, DEFAULT_PREFIXES);
}
}