[ZBX-13778] Logically dead code in JSON Path parser Created: 2018 Apr 21 Updated: 2018 May 24 Resolved: 2018 May 23 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 3.4.9rc1, 4.0.0alpha6 |
Fix Version/s: | 4.0.0alpha7, 4.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Glebs Ivanovskis (Inactive) | Assignee: | Michael Veksler |
Resolution: | Fixed | Votes: | 0 |
Labels: | codequality | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
||||||||
Team: | Team C | ||||||||
Sprint: | Sprint 33, Sprint 34 | ||||||||
Story Points: | 0.125 |
Description |
The code below increments pos in a loop while 0 != isdigit(next[pos]), but on the first iteration next[pos] is the same as *next and since the loop is placed inside if (0 != isdigit(*next)) it is guaranteed that at least one iteration of the loop and at least one pos++ will be executed. As a consequence if (0 == pos) block is logically dead. /* process array index component */ if (0 != isdigit(*next)) { for (pos = 0; 0 != isdigit(next[pos]); pos++) ; if (0 == pos) return zbx_jsonpath_error(*pnext); ... |
Comments |
Comment by Glebs Ivanovskis (Inactive) [ 2018 Apr 21 ] |
(1) [S] Also this piece of code appears twice: while (*next == ' ') next++; if (']' != *next++) return zbx_jsonpath_error(*pnext); *pnext = next; MVekslers RESOLVED in r80848. s.paskevics CLOSED |
Comment by Sergejs Paskevics [ 2018 May 17 ] |
Successfully tested |
Comment by Michael Veksler [ 2018 May 21 ] |
Available in pre-4.0.0alpha7 (trunk) r81015. |