Branch Coverage

c-lib/s-bspatch.c
Criterion Covered Total %
branch 59 148 39.8


line true false branch
65 0 2592 if(buf[0] & 0x80)
85 0 0 if(b >= 0){
86 0 0 if(a >= s_BSDIPA_OFF_MAX - b)
88 0 0 }else if(a < s_BSDIPA_OFF_MIN - b)
107 0 432 if(x < 0)
109 0 432 if(x & (sizeof(s_bsdipa_off_t) - 1))
111 0 432 if(x % (sizeof(s_bsdipa_off_t) * 3))
118 0 432 if(x < 0)
120 0 432 if(s_BSDIPA_OFF_MAX - y <= x)
127 0 432 if(x < 0)
129 0 432 if(s_BSDIPA_OFF_MAX - y <= x)
135 0 432 if(x < 0)
137 0 432 if(x == 0){
138 0 0 if(hp->h_ctrl_len != 0 || hp->h_diff_len != 0 || hp->h_extra_len != 0)
0 0 if(hp->h_ctrl_len != 0 || hp->h_diff_len != 0 || hp->h_extra_len != 0)
0 0 if(hp->h_ctrl_len != 0 || hp->h_diff_len != 0 || hp->h_extra_len != 0)
141 432 0 if(x >= s_BSDIPA_OFF_MAX || (uint64_t)x >= SIZE_MAX / sizeof(s_bsdipa_off_t))
0 432 if(x >= s_BSDIPA_OFF_MAX || (uint64_t)x >= SIZE_MAX / sizeof(s_bsdipa_off_t))
143 0 432 if(x - hp->h_extra_len != hp->h_diff_len)
147 0 432 if(x + 1 < hp->h_ctrl_len / ((s_bsdipa_off_t)sizeof(s_bsdipa_off_t) * 3))
163 288 0 if(pcp->pc_mem.mc_alloc != NULL){
175 288 0 if(pcp->pc_patch_dat != NULL){
183 288 0 if(respos < 0 || x < (uint64_t)respos)
0 288 if(respos < 0 || x < (uint64_t)respos)
189 288 0 if(respos < 0 || x < (uint64_t)respos)
0 288 if(respos < 0 || x < (uint64_t)respos)
196 288 0 if(respos < 0 || x < (uint64_t)respos)
0 288 if(respos < 0 || x < (uint64_t)respos)
201 0 0 if(respos < 0 || respos >= s_BSDIPA_OFF_MAX)
0 0 if(respos < 0 || respos >= s_BSDIPA_OFF_MAX)
204 0 0 if(respos < 0 || respos >= s_BSDIPA_OFF_MAX)
0 0 if(respos < 0 || respos >= s_BSDIPA_OFF_MAX)
207 0 0 if(aftpos < 0 || aftpos >= s_BSDIPA_OFF_MAX)
0 0 if(aftpos < 0 || aftpos >= s_BSDIPA_OFF_MAX)
209 0 0 if(s_BSDIPA_OFF_MAX - aftpos <= respos)
212 0 0 if(s_BSDIPA_OFF_MAX - respos <= pcp->pc_header.h_ctrl_len)
217 0 288 if(pcp->pc_after_len >= s_BSDIPA_OFF_MAX)
220 0 288 if((respos = pcp->pc_header.h_before_len) == 0){
221 0 0 if(pcp->pc_header.h_ctrl_len != 0 || pcp->pc_header.h_diff_len != 0 || pcp->pc_header.h_extra_len != 0)
0 0 if(pcp->pc_header.h_ctrl_len != 0 || pcp->pc_header.h_diff_len != 0 || pcp->pc_header.h_extra_len != 0)
0 0 if(pcp->pc_header.h_ctrl_len != 0 || pcp->pc_header.h_diff_len != 0 || pcp->pc_header.h_extra_len != 0)
223 288 0 }else if(respos < 0 || respos >= s_BSDIPA_OFF_MAX)
0 288 }else if(respos < 0 || respos >= s_BSDIPA_OFF_MAX)
225 0 288 else if(respos - pcp->pc_header.h_extra_len != pcp->pc_header.h_diff_len)
231 0 288 if((uint64_t)pcp->pc_header.h_before_len >= SIZE_MAX - 1)
234 144 144 if(pcp->pc_max_allowed_restored_len != 0 &&
235 0 144 pcp->pc_max_allowed_restored_len < (uint64_t)pcp->pc_header.h_before_len)
242 0 288 if(pcp->pc_restored_dat == NULL){
249 288 288 for(any_tick = 0, aftpos = respos = 0; respos < pcp->pc_header.h_before_len; any_tick = 1){
252 0 288 if(pcp->pc_header.h_ctrl_len < (s_bsdipa_off_t)sizeof(s_bsdipa_off_t) * 3)
256 864 288 for(i = 0; i < 3; ++i){
261 288 0 if((k = ctrl[1]) < 0 || k >= s_BSDIPA_OFF_MAX)
0 288 if((k = ctrl[1]) < 0 || k >= s_BSDIPA_OFF_MAX)
263 288 0 if((j = ctrl[0]) < 0 || j >= s_BSDIPA_OFF_MAX)
0 288 if((j = ctrl[0]) < 0 || j >= s_BSDIPA_OFF_MAX)
267 0 288 if(any_tick && k == 0 && j == 0)
0 0 if(any_tick && k == 0 && j == 0)
0 0 if(any_tick && k == 0 && j == 0)
272 120 168 if(j != 0){
273 0 120 if(pcp->pc_header.h_diff_len < j)
277 120 0 if(!a_bspatch_check_add_positive(respos, j) || respos + j > pcp->pc_header.h_before_len)
0 120 if(!a_bspatch_check_add_positive(respos, j) || respos + j > pcp->pc_header.h_before_len)
279 120 0 if(!a_bspatch_check_add_positive(aftpos, j) || aftpos + j > (s_bsdipa_off_t)pcp->pc_after_len)
0 120 if(!a_bspatch_check_add_positive(aftpos, j) || aftpos + j > (s_bsdipa_off_t)pcp->pc_after_len)
282 1225008 120 while(j-- != 0)
288 168 120 if(j != 0){
289 0 168 if(pcp->pc_header.h_extra_len < j)
293 168 0 if(!a_bspatch_check_add_positive(respos, j) || respos + j > pcp->pc_header.h_before_len)
0 168 if(!a_bspatch_check_add_positive(respos, j) || respos + j > pcp->pc_header.h_before_len)
304 0 288 if(j != 0){
305 0 0 if(!a_bspatch_check_add(aftpos, j))
308 0 0 if(aftpos < 0)
313 0 288 if(pcp->pc_header.h_ctrl_len == 0)
322 0 288 if(pcp->pc_restored_dat != NULL)