Skip to content

Commit 0572994

Browse files
author
kayji
committed
Added some comments in cve20160808.c
1 parent bd9af53 commit 0572994

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app/src/main/jni/cve20160808.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
#include <stdint.h>
55
#include <android/log.h>
66

7+
/*
8+
When user loads a third-party ttf font:
9+
in frameworks/minikin/CmapCoverage.cpp::getCoverageFormat12
10+
if nGroups >= 0xfffffff0 / kGroupSize, then the ttf font will
11+
cause continuous rebooting
12+
*/
13+
714
int checkIsVulnerable(){
815
FILE *file;
916
long size;
@@ -14,6 +21,8 @@ int checkIsVulnerable(){
1421
file = fopen("/system/lib/libminikin.so", "rb");
1522

1623
if(file == NULL){
24+
// Before 5.0, libminikin didn't exist
25+
// Hence, not vulnerable
1726
result = 0;
1827
goto done;
1928
}
@@ -25,12 +34,21 @@ int checkIsVulnerable(){
2534
buffer = (uint8_t *)malloc(sizeof(char)*size);
2635

2736
fread(buffer, 1, size, file);
37+
38+
/*
39+
kGroupSize = 12
40+
const size_t kMaxNGroups = 0xfffffff0 / kGroupSize ~ 0x15555553 (how it appears in the assembly)
41+
*/
42+
43+
// Check if this byte-sequence is in libminikin.so file
2844
uint8_t needle[4] = {0x53, 0x55, 0x55, 0x15};
2945

3046
uint8_t *p = memmem(buffer, size, needle, 4);
47+
48+
// If the byte-sequence is present, that means the bug has been patched
3149
if(p)
3250
result = 0;
33-
else
51+
else // Otherwise, there is no check for nGroups <=> vulnerable
3452
result = 1;
3553

3654
fclose(file);

0 commit comments

Comments
 (0)