Integer "corruption" in javascript preprocessing

XMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: 7.0.0alpha5
    • Component/s: Documentation (D)
    • None
    • Environment:
      Debian 12

      Javascript internally uses float64 to represent integers.

      This intentional design flaw corrupts big numbers in Javascript preprocessing.

       

      Simple preprocessing example: "return 123456789123456789".

      You expect 123456789123456789 ? Wrong! It is 123456789123456780.

       

      For this to bite, javascript must convert input string to number.

      Unfortunately this happens whenever you edit JSON by javascript:

      Script: "var data=JSON.parse(value); return JSON.stringify(data)"
      
      Input: "\{"victim": 123456789123456789}"
      
      Output: "\{"victim":123456789123456780}"
      
      

      For monitoring servers its probably OK if petabyte storage is few bytes off,

      but when we get creative, things may corrupt - and it will be completely silent.

            Assignee:
            Zabbix Development Team
            Reporter:
            user185953
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: