[ZBX-15826] Suboptimal unsupported macro parsing Created: 2019 Mar 15  Updated: 2024 Apr 10  Resolved: 2019 Apr 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 4.0.5, 4.2.0beta2
Fix Version/s: 4.0.7rc1, 4.2.1rc1, 4.4.0alpha1, 4.4 (plan)

Type: Problem report Priority: Trivial
Reporter: Andris Zeila Assignee: Andrejs Kozlovs
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team A
Sprint: Sprint 50 (Mar 2019), Sprint 51 (Apr 2019)
Story Points: 0.25

 Description   

When server is expanding macros in a string and detects an unsupported (by location) macro, it increments cursor position in the string and tries to find a token again. This will lead the same token being parsed and 'refused' again and again until the cursor position will reach the token.

Instead of incrementing cursor position by 1 it should be set to the left position of the unsupported token +1. The following patch should fix it, but needs to be carefully evaluated.

Index: src/libs/zbxserver/expression.c
===================================================================
--- src/libs/zbxserver/expression.c    (revision 91057)
+++ src/libs/zbxserver/expression.c    (working copy)
@@ -2712,6 +2712,7 @@
         require_numeric = 0;
         N_functionid = 1;
         raw_value = 0;
+        pos = token.loc.l;
 
         switch (token.type)
         {

Still the real life impact is probably non-existant, as users will not use macros where they are not supported.



 Comments   
Comment by Andrejs Kozlovs [ 2019 Apr 03 ]

Fixed in:

  • pre-4.0.7rc1 r91871
  • pre-4.2.1rc1 r91872
  • pre-4.4.0alpha1 (trunk) r91873
Generated at Thu Apr 25 18:09:25 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.