본문 바로가기

Hello Android

run cts -m CtsOsTestCases -t android.os.cts.ParcelTest#testMaliciousMapWrite

[CTS][Android9.0]

 

run cts -m CtsOsTestCases -t android.os.cts.ParcelTest#testMaliciousMapWrite

junit.framework.AssertionFailedError: Should have thrown a BadParcelableException

 

frameworks/base/core/java/android/os/Parcel.java

original source

    /* package */ void writeMapInternal(Map<String,Object> val) {
        if (val == null) {
            writeInt(-1);
            return;
        }
        Set<Map.Entry<String,Object>> entries = val.entrySet();
        writeInt(entries.size());
        for (Map.Entry<String,Object> e : entries) {
            writeValue(e.getKey());
            writeValue(e.getValue());
        }
    }

frameworks/base/core/java/android/os/Parcel.java

modified source

    /* package */ void writeMapInternal(Map<String,Object> val) {
        if (val == null) {
            writeInt(-1);
            return;
        }
        Set<Map.Entry<String,Object>> entries = val.entrySet();
        int size = entries.size();
        writeInt(size);

        for (Map.Entry<String,Object> e : entries) {
            writeValue(e.getKey());
            writeValue(e.getValue());
            size--;
        }

        if (size != 0) {
            throw new BadParcelableException("Map size does not match number of entries!");
        }

    }

 

'Hello Android' 카테고리의 다른 글

run cts -m CtsCameraTestCases -t android.hardware.cts.CameraTest#testPreviewFpsRange  (0) 2019.11.05
hw_get_module  (0) 2017.03.17
안드로이드 원격조정 seven-square  (0) 2016.07.12
문자열 API  (0) 2015.11.03
spin_lock_irq 문제  (0) 2015.09.15