Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_utf8.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | int | - | ||||||||||||||||||||||||
4 | UTF8_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
| 1-171051453 | ||||||||||||||||||||||||
10 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
11 | p = str; | - | ||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||
14 | if ((*
| 54768-170996685 | ||||||||||||||||||||||||
15 | value = *p++ & 0x7f; | - | ||||||||||||||||||||||||
16 | ret = 1; | - | ||||||||||||||||||||||||
17 | } executed 54768 times by 9 tests: else if ((*end of block Executed by:
| 17282-170979403 | ||||||||||||||||||||||||
18 | if (*
| 2-17280 | ||||||||||||||||||||||||
19 | return executed 2 times by 1 test: -2;return -2; Executed by:
executed 2 times by 1 test: return -2; Executed by:
| 2 | ||||||||||||||||||||||||
20 | if (len < 2
| 7680-9600 | ||||||||||||||||||||||||
21 | return executed 7680 times by 1 test: -1;return -1; Executed by:
executed 7680 times by 1 test: return -1; Executed by:
| 7680 | ||||||||||||||||||||||||
22 | if ((
| 3840-5760 | ||||||||||||||||||||||||
23 | return executed 5760 times by 1 test: -3;return -3; Executed by:
executed 5760 times by 1 test: return -3; Executed by:
| 5760 | ||||||||||||||||||||||||
24 | value = (*p++ & 0x1f) << 6; | - | ||||||||||||||||||||||||
25 | value |= *p++ & 0x3f; | - | ||||||||||||||||||||||||
26 | if (value < 0x80
| 0-3840 | ||||||||||||||||||||||||
27 | return never executed: -4;return -4; never executed: return -4; | 0 | ||||||||||||||||||||||||
28 | ret = 2; | - | ||||||||||||||||||||||||
29 | } executed 3840 times by 1 test: else if ((*end of block Executed by:
| 3840-168820811 | ||||||||||||||||||||||||
30 | if (len < 3
| 1048576-1110016 | ||||||||||||||||||||||||
31 | return executed 1048576 times by 1 test: -1;return -1; Executed by:
executed 1048576 times by 1 test: return -1; Executed by:
| 1048576 | ||||||||||||||||||||||||
32 | if (((
| 323584-786432 | ||||||||||||||||||||||||
33 | ((
| 126976-196608 | ||||||||||||||||||||||||
34 | return executed 983040 times by 1 test: -3;return -3; Executed by:
executed 983040 times by 1 test: return -3; Executed by:
| 983040 | ||||||||||||||||||||||||
35 | value = (*p++ & 0xf) << 12; | - | ||||||||||||||||||||||||
36 | value |= (*p++ & 0x3f) << 6; | - | ||||||||||||||||||||||||
37 | value |= *p++ & 0x3f; | - | ||||||||||||||||||||||||
38 | if (value < 0x800
| 2048-124928 | ||||||||||||||||||||||||
39 | return executed 2048 times by 1 test: -4;return -4; Executed by:
executed 2048 times by 1 test: return -4; Executed by:
| 2048 | ||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | if (value >= 0xd800
| 2048-106496 | ||||||||||||||||||||||||
42 | return executed 2048 times by 1 test: -2;return -2; Executed by:
executed 2048 times by 1 test: return -2; Executed by:
| 2048 | ||||||||||||||||||||||||
43 | ret = 3; | - | ||||||||||||||||||||||||
44 | } executed 122880 times by 1 test: else if ((*end of block Executed by:
| 3-168820739 | ||||||||||||||||||||||||
45 | if (len < 4
| 83886080-84934656 | ||||||||||||||||||||||||
46 | return executed 83886080 times by 1 test: -1;return -1; Executed by:
executed 83886080 times by 1 test: return -1; Executed by:
| 83886080 | ||||||||||||||||||||||||
47 | if (((
| 22020096-62914560 | ||||||||||||||||||||||||
48 | ((
| 6291456-15728640 | ||||||||||||||||||||||||
49 | ((
| 2359296-3932160 | ||||||||||||||||||||||||
50 | return executed 82575360 times by 1 test: -3;return -3; Executed by:
executed 82575360 times by 1 test: return -3; Executed by:
| 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
| 65536-2293760 | ||||||||||||||||||||||||
56 | return executed 65536 times by 1 test: -4;return -4; Executed by:
executed 65536 times by 1 test: return -4; Executed by:
| 65536 | ||||||||||||||||||||||||
57 | if (value > 0x10FFFF
| 196608-2097152 | ||||||||||||||||||||||||
58 | return executed 196608 times by 1 test: -2;return -2; Executed by:
executed 196608 times by 1 test: return -2; Executed by:
| 196608 | ||||||||||||||||||||||||
59 | ret = 4; | - | ||||||||||||||||||||||||
60 | } executed 2097152 times by 1 test: elseend of block Executed by:
| 2097152 | ||||||||||||||||||||||||
61 | return executed 75 times by 1 test: -2;return -2; Executed by:
executed 75 times by 1 test: return -2; Executed by:
| 75 | ||||||||||||||||||||||||
62 | *val = value; | - | ||||||||||||||||||||||||
63 | return executed 2278640 times by 9 tests: ret;return ret; Executed by:
executed 2278640 times by 9 tests: return ret; Executed by:
| 2278640 | ||||||||||||||||||||||||
64 | } | - | ||||||||||||||||||||||||
65 | int | - | ||||||||||||||||||||||||
66 | UTF8_putc(unsigned char *str, int len, unsigned long value) | - | ||||||||||||||||||||||||
67 | { | - | ||||||||||||||||||||||||
68 | if (value < 0x80
| 3006-3338367 | ||||||||||||||||||||||||
69 | if (str !=
| 1439-1567 | ||||||||||||||||||||||||
70 | ((void *)0)
| 1439-1567 | ||||||||||||||||||||||||
71 | ) { | - | ||||||||||||||||||||||||
72 | if (len < 1
| 128-1439 | ||||||||||||||||||||||||
73 | return executed 128 times by 1 test: -1;return -1; Executed by:
executed 128 times by 1 test: return -1; Executed by:
| 128 | ||||||||||||||||||||||||
74 | str[0] = (unsigned char)value; | - | ||||||||||||||||||||||||
75 | } executed 1439 times by 8 tests: end of block Executed by:
| 1439 | ||||||||||||||||||||||||
76 | return executed 2878 times by 8 tests: 1;return 1; Executed by:
executed 2878 times by 8 tests: return 1; Executed by:
| 2878 | ||||||||||||||||||||||||
77 | } | - | ||||||||||||||||||||||||
78 | if (value < 0x800
| 5760-3332607 | ||||||||||||||||||||||||
79 | if (str !=
| 1920-3840 | ||||||||||||||||||||||||
80 | ((void *)0)
| 1920-3840 | ||||||||||||||||||||||||
81 | ) { | - | ||||||||||||||||||||||||
82 | if (len < 2
| 1920 | ||||||||||||||||||||||||
83 | return executed 1920 times by 1 test: -1;return -1; Executed by:
executed 1920 times by 1 test: return -1; Executed by:
| 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:
| 1920 | ||||||||||||||||||||||||
87 | return executed 3840 times by 1 test: 2;return 2; Executed by:
executed 3840 times by 1 test: return 2; Executed by:
| 3840 | ||||||||||||||||||||||||
88 | } | - | ||||||||||||||||||||||||
89 | if (value < 0x10000
| 186368-3146239 | ||||||||||||||||||||||||
90 | if (((
| 2048-159744 | ||||||||||||||||||||||||
91 | return executed 2048 times by 1 test: -2;return -2; Executed by:
executed 2048 times by 1 test: return -2; Executed by:
| 2048 | ||||||||||||||||||||||||
92 | if (str !=
| 61440-122880 | ||||||||||||||||||||||||
93 | ((void *)0)
| 61440-122880 | ||||||||||||||||||||||||
94 | ) { | - | ||||||||||||||||||||||||
95 | if (len < 3
| 61440 | ||||||||||||||||||||||||
96 | return executed 61440 times by 1 test: -1;return -1; Executed by:
executed 61440 times by 1 test: return -1; Executed by:
| 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:
| 61440 | ||||||||||||||||||||||||
101 | return executed 122880 times by 1 test: 3;return 3; Executed by:
executed 122880 times by 1 test: return 3; Executed by:
| 122880 | ||||||||||||||||||||||||
102 | } | - | ||||||||||||||||||||||||
103 | if (value <= 0x10FFFF
| 511-3145728 | ||||||||||||||||||||||||
104 | if (str !=
| 1048576-2097152 | ||||||||||||||||||||||||
105 | ((void *)0)
| 1048576-2097152 | ||||||||||||||||||||||||
106 | ) { | - | ||||||||||||||||||||||||
107 | if (len < 4
| 1048576 | ||||||||||||||||||||||||
108 | return executed 1048576 times by 1 test: -1;return -1; Executed by:
executed 1048576 times by 1 test: return -1; Executed by:
| 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:
| 1048576 | ||||||||||||||||||||||||
114 | return executed 2097152 times by 1 test: 4;return 4; Executed by:
executed 2097152 times by 1 test: return 4; Executed by:
| 2097152 | ||||||||||||||||||||||||
115 | } | - | ||||||||||||||||||||||||
116 | return executed 511 times by 1 test: -2;return -2; Executed by:
executed 511 times by 1 test: return -2; Executed by:
| 511 | ||||||||||||||||||||||||
117 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |