OpenCoverage

a_utf8.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_utf8.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3int-
4UTF8_getc(const unsigned char *str, int len, unsigned long *val)-
5{-
6 const unsigned char *p;-
7 unsigned long value;-
8 int ret;-
9 if (len <= 0
len <= 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 171051453 times by 9 tests
Evaluated by:
  • asn1test
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
)
1-171051453
10 return
executed 1 time by 1 test: return 0;
Executed by:
  • utf8test
0;
executed 1 time by 1 test: return 0;
Executed by:
  • utf8test
1
11 p = str;-
12-
13-
14 if ((*
(*p & 0x80) == 0Description
TRUEevaluated 54768 times by 9 tests
Evaluated by:
  • asn1test
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
FALSEevaluated 170996685 times by 1 test
Evaluated by:
  • utf8test
p & 0x80) == 0
(*p & 0x80) == 0Description
TRUEevaluated 54768 times by 9 tests
Evaluated by:
  • asn1test
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
FALSEevaluated 170996685 times by 1 test
Evaluated by:
  • utf8test
) {
54768-170996685
15 value = *p++ & 0x7f;-
16 ret = 1;-
17 }
executed 54768 times by 9 tests: end of block
Executed by:
  • asn1test
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
else if ((*
(*p & 0xe0) == 0xc0Description
TRUEevaluated 17282 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 170979403 times by 1 test
Evaluated by:
  • utf8test
p & 0xe0) == 0xc0
(*p & 0xe0) == 0xc0Description
TRUEevaluated 17282 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 170979403 times by 1 test
Evaluated by:
  • utf8test
) {
17282-170979403
18 if (*
*p < 0xc2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 17280 times by 1 test
Evaluated by:
  • utf8test
p < 0xc2
*p < 0xc2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 17280 times by 1 test
Evaluated by:
  • utf8test
)
2-17280
19 return
executed 2 times by 1 test: return -2;
Executed by:
  • utf8test
-2;
executed 2 times by 1 test: return -2;
Executed by:
  • utf8test
2
20 if (len < 2
len < 2Description
TRUEevaluated 7680 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 9600 times by 1 test
Evaluated by:
  • utf8test
)
7680-9600
21 return
executed 7680 times by 1 test: return -1;
Executed by:
  • utf8test
-1;
executed 7680 times by 1 test: return -1;
Executed by:
  • utf8test
7680
22 if ((
(p[1] & 0xc0) != 0x80Description
TRUEevaluated 5760 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 3840 times by 1 test
Evaluated by:
  • utf8test
p[1] & 0xc0) != 0x80
(p[1] & 0xc0) != 0x80Description
TRUEevaluated 5760 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 3840 times by 1 test
Evaluated by:
  • utf8test
)
3840-5760
23 return
executed 5760 times by 1 test: return -3;
Executed by:
  • utf8test
-3;
executed 5760 times by 1 test: return -3;
Executed by:
  • utf8test
5760
24 value = (*p++ & 0x1f) << 6;-
25 value |= *p++ & 0x3f;-
26 if (value < 0x80
value < 0x80Description
TRUEnever evaluated
FALSEevaluated 3840 times by 1 test
Evaluated by:
  • utf8test
)
0-3840
27 return
never executed: return -4;
-4;
never executed: return -4;
0
28 ret = 2;-
29 }
executed 3840 times by 1 test: end of block
Executed by:
  • utf8test
else if ((*
(*p & 0xf0) == 0xe0Description
TRUEevaluated 2158592 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 168820811 times by 1 test
Evaluated by:
  • utf8test
p & 0xf0) == 0xe0
(*p & 0xf0) == 0xe0Description
TRUEevaluated 2158592 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 168820811 times by 1 test
Evaluated by:
  • utf8test
) {
3840-168820811
30 if (len < 3
len < 3Description
TRUEevaluated 1048576 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1110016 times by 1 test
Evaluated by:
  • utf8test
)
1048576-1110016
31 return
executed 1048576 times by 1 test: return -1;
Executed by:
  • utf8test
-1;
executed 1048576 times by 1 test: return -1;
Executed by:
  • utf8test
1048576
32 if (((
((p[1] & 0xc0) != 0x80)Description
TRUEevaluated 786432 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 323584 times by 1 test
Evaluated by:
  • utf8test
p[1] & 0xc0) != 0x80)
((p[1] & 0xc0) != 0x80)Description
TRUEevaluated 786432 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 323584 times by 1 test
Evaluated by:
  • utf8test
||
323584-786432
33 ((
((p[2] & 0xc0) != 0x80)Description
TRUEevaluated 196608 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 126976 times by 1 test
Evaluated by:
  • utf8test
p[2] & 0xc0) != 0x80)
((p[2] & 0xc0) != 0x80)Description
TRUEevaluated 196608 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 126976 times by 1 test
Evaluated by:
  • utf8test
)
126976-196608
34 return
executed 983040 times by 1 test: return -3;
Executed by:
  • utf8test
-3;
executed 983040 times by 1 test: return -3;
Executed by:
  • utf8test
983040
35 value = (*p++ & 0xf) << 12;-
36 value |= (*p++ & 0x3f) << 6;-
37 value |= *p++ & 0x3f;-
38 if (value < 0x800
value < 0x800Description
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 124928 times by 1 test
Evaluated by:
  • utf8test
)
2048-124928
39 return
executed 2048 times by 1 test: return -4;
Executed by:
  • utf8test
-4;
executed 2048 times by 1 test: return -4;
Executed by:
  • utf8test
2048
40-
41 if (value >= 0xd800
value >= 0xd800Description
TRUEevaluated 18432 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 106496 times by 1 test
Evaluated by:
  • utf8test
&& value < 0xe000
value < 0xe000Description
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 16384 times by 1 test
Evaluated by:
  • utf8test
)
2048-106496
42 return
executed 2048 times by 1 test: return -2;
Executed by:
  • utf8test
-2;
executed 2048 times by 1 test: return -2;
Executed by:
  • utf8test
2048
43 ret = 3;-
44 }
executed 122880 times by 1 test: end of block
Executed by:
  • utf8test
else if ((*
(*p & 0xf8) == 0xf0Description
TRUEevaluated 168820739 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 72 times by 1 test
Evaluated by:
  • utf8test
p & 0xf8) == 0xf0
(*p & 0xf8) == 0xf0Description
TRUEevaluated 168820739 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 72 times by 1 test
Evaluated by:
  • utf8test
&& (*
(*p < 0xf5)Description
TRUEevaluated 168820736 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • utf8test
p < 0xf5)
(*p < 0xf5)Description
TRUEevaluated 168820736 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • utf8test
) {
3-168820739
45 if (len < 4
len < 4Description
TRUEevaluated 83886080 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 84934656 times by 1 test
Evaluated by:
  • utf8test
)
83886080-84934656
46 return
executed 83886080 times by 1 test: return -1;
Executed by:
  • utf8test
-1;
executed 83886080 times by 1 test: return -1;
Executed by:
  • utf8test
83886080
47 if (((
((p[1] & 0xc0) != 0x80)Description
TRUEevaluated 62914560 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 22020096 times by 1 test
Evaluated by:
  • utf8test
p[1] & 0xc0) != 0x80)
((p[1] & 0xc0) != 0x80)Description
TRUEevaluated 62914560 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 22020096 times by 1 test
Evaluated by:
  • utf8test
||
22020096-62914560
48 ((
((p[2] & 0xc0) != 0x80)Description
TRUEevaluated 15728640 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 6291456 times by 1 test
Evaluated by:
  • utf8test
p[2] & 0xc0) != 0x80)
((p[2] & 0xc0) != 0x80)Description
TRUEevaluated 15728640 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 6291456 times by 1 test
Evaluated by:
  • utf8test
||
6291456-15728640
49 ((
((p[3] & 0xc0) != 0x80)Description
TRUEevaluated 3932160 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 2359296 times by 1 test
Evaluated by:
  • utf8test
p[3] & 0xc0) != 0x80)
((p[3] & 0xc0) != 0x80)Description
TRUEevaluated 3932160 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 2359296 times by 1 test
Evaluated by:
  • utf8test
)
2359296-3932160
50 return
executed 82575360 times by 1 test: return -3;
Executed by:
  • utf8test
-3;
executed 82575360 times by 1 test: return -3;
Executed by:
  • utf8test
82575360
51 value = ((unsigned long)(*p++ & 0x7)) << 18;-
52 value |= (*p++ & 0x3f) << 12;-
53 value |= (*p++ & 0x3f) << 6;-
54 value |= *p++ & 0x3f;-
55 if (value < 0x10000
value < 0x10000Description
TRUEevaluated 65536 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 2293760 times by 1 test
Evaluated by:
  • utf8test
)
65536-2293760
56 return
executed 65536 times by 1 test: return -4;
Executed by:
  • utf8test
-4;
executed 65536 times by 1 test: return -4;
Executed by:
  • utf8test
65536
57 if (value > 0x10FFFF
value > 0x10FFFFDescription
TRUEevaluated 196608 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 2097152 times by 1 test
Evaluated by:
  • utf8test
)
196608-2097152
58 return
executed 196608 times by 1 test: return -2;
Executed by:
  • utf8test
-2;
executed 196608 times by 1 test: return -2;
Executed by:
  • utf8test
196608
59 ret = 4;-
60 }
executed 2097152 times by 1 test: end of block
Executed by:
  • utf8test
else
2097152
61 return
executed 75 times by 1 test: return -2;
Executed by:
  • utf8test
-2;
executed 75 times by 1 test: return -2;
Executed by:
  • utf8test
75
62 *val = value;-
63 return
executed 2278640 times by 9 tests: return ret;
Executed by:
  • asn1test
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
ret;
executed 2278640 times by 9 tests: return ret;
Executed by:
  • asn1test
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
2278640
64}-
65int-
66UTF8_putc(unsigned char *str, int len, unsigned long value)-
67{-
68 if (value < 0x80
value < 0x80Description
TRUEevaluated 3006 times by 8 tests
Evaluated by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
FALSEevaluated 3338367 times by 1 test
Evaluated by:
  • utf8test
) {
3006-3338367
69 if (str !=
str != ((void *)0)Description
TRUEevaluated 1567 times by 8 tests
Evaluated by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
FALSEevaluated 1439 times by 8 tests
Evaluated by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
1439-1567
70 ((void *)0)
str != ((void *)0)Description
TRUEevaluated 1567 times by 8 tests
Evaluated by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
FALSEevaluated 1439 times by 8 tests
Evaluated by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
1439-1567
71 ) {-
72 if (len < 1
len < 1Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1439 times by 8 tests
Evaluated by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
)
128-1439
73 return
executed 128 times by 1 test: return -1;
Executed by:
  • utf8test
-1;
executed 128 times by 1 test: return -1;
Executed by:
  • utf8test
128
74 str[0] = (unsigned char)value;-
75 }
executed 1439 times by 8 tests: end of block
Executed by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
1439
76 return
executed 2878 times by 8 tests: return 1;
Executed by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
1;
executed 2878 times by 8 tests: return 1;
Executed by:
  • keypairtest
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
  • utf8test
  • verifytest
2878
77 }-
78 if (value < 0x800
value < 0x800Description
TRUEevaluated 5760 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 3332607 times by 1 test
Evaluated by:
  • utf8test
) {
5760-3332607
79 if (str !=
str != ((void *)0)Description
TRUEevaluated 3840 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1920 times by 1 test
Evaluated by:
  • utf8test
1920-3840
80 ((void *)0)
str != ((void *)0)Description
TRUEevaluated 3840 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1920 times by 1 test
Evaluated by:
  • utf8test
1920-3840
81 ) {-
82 if (len < 2
len < 2Description
TRUEevaluated 1920 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1920 times by 1 test
Evaluated by:
  • utf8test
)
1920
83 return
executed 1920 times by 1 test: return -1;
Executed by:
  • utf8test
-1;
executed 1920 times by 1 test: return -1;
Executed by:
  • utf8test
1920
84 str[0] = (unsigned char)(((value >> 6) & 0x1f) | 0xc0);-
85 str[1] = (unsigned char)((value & 0x3f) | 0x80);-
86 }
executed 1920 times by 1 test: end of block
Executed by:
  • utf8test
1920
87 return
executed 3840 times by 1 test: return 2;
Executed by:
  • utf8test
2;
executed 3840 times by 1 test: return 2;
Executed by:
  • utf8test
3840
88 }-
89 if (value < 0x10000
value < 0x10000Description
TRUEevaluated 186368 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 3146239 times by 1 test
Evaluated by:
  • utf8test
) {
186368-3146239
90 if (((
(value) >= 0x00D800Description
TRUEevaluated 26624 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 159744 times by 1 test
Evaluated by:
  • utf8test
value) >= 0x00D800
(value) >= 0x00D800Description
TRUEevaluated 26624 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 159744 times by 1 test
Evaluated by:
  • utf8test
&& (
(value) <= 0x00DFFFDescription
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 24576 times by 1 test
Evaluated by:
  • utf8test
value) <= 0x00DFFF
(value) <= 0x00DFFFDescription
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 24576 times by 1 test
Evaluated by:
  • utf8test
))
2048-159744
91 return
executed 2048 times by 1 test: return -2;
Executed by:
  • utf8test
-2;
executed 2048 times by 1 test: return -2;
Executed by:
  • utf8test
2048
92 if (str !=
str != ((void *)0)Description
TRUEevaluated 122880 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 61440 times by 1 test
Evaluated by:
  • utf8test
61440-122880
93 ((void *)0)
str != ((void *)0)Description
TRUEevaluated 122880 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 61440 times by 1 test
Evaluated by:
  • utf8test
61440-122880
94 ) {-
95 if (len < 3
len < 3Description
TRUEevaluated 61440 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 61440 times by 1 test
Evaluated by:
  • utf8test
)
61440
96 return
executed 61440 times by 1 test: return -1;
Executed by:
  • utf8test
-1;
executed 61440 times by 1 test: return -1;
Executed by:
  • utf8test
61440
97 str[0] = (unsigned char)(((value >> 12) & 0xf) | 0xe0);-
98 str[1] = (unsigned char)(((value >> 6) & 0x3f) | 0x80);-
99 str[2] = (unsigned char)((value & 0x3f) | 0x80);-
100 }
executed 61440 times by 1 test: end of block
Executed by:
  • utf8test
61440
101 return
executed 122880 times by 1 test: return 3;
Executed by:
  • utf8test
3;
executed 122880 times by 1 test: return 3;
Executed by:
  • utf8test
122880
102 }-
103 if (value <= 0x10FFFF
value <= 0x10FFFFDescription
TRUEevaluated 3145728 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 511 times by 1 test
Evaluated by:
  • utf8test
) {
511-3145728
104 if (str !=
str != ((void *)0)Description
TRUEevaluated 2097152 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1048576 times by 1 test
Evaluated by:
  • utf8test
1048576-2097152
105 ((void *)0)
str != ((void *)0)Description
TRUEevaluated 2097152 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1048576 times by 1 test
Evaluated by:
  • utf8test
1048576-2097152
106 ) {-
107 if (len < 4
len < 4Description
TRUEevaluated 1048576 times by 1 test
Evaluated by:
  • utf8test
FALSEevaluated 1048576 times by 1 test
Evaluated by:
  • utf8test
)
1048576
108 return
executed 1048576 times by 1 test: return -1;
Executed by:
  • utf8test
-1;
executed 1048576 times by 1 test: return -1;
Executed by:
  • utf8test
1048576
109 str[0] = (unsigned char)(((value >> 18) & 0x7) | 0xf0);-
110 str[1] = (unsigned char)(((value >> 12) & 0x3f) | 0x80);-
111 str[2] = (unsigned char)(((value >> 6) & 0x3f) | 0x80);-
112 str[3] = (unsigned char)((value & 0x3f) | 0x80);-
113 }
executed 1048576 times by 1 test: end of block
Executed by:
  • utf8test
1048576
114 return
executed 2097152 times by 1 test: return 4;
Executed by:
  • utf8test
4;
executed 2097152 times by 1 test: return 4;
Executed by:
  • utf8test
2097152
115 }-
116 return
executed 511 times by 1 test: return -2;
Executed by:
  • utf8test
-2;
executed 511 times by 1 test: return -2;
Executed by:
  • utf8test
511
117}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2