Files
zoneminder/web/ajax
Isaac Connor 56030724ed fix: stop the js log endpoint 500ing on a Firefox line:column location
Firefox reports an error location as "line:column", for example 1500:28.
ajax/log.php passed that through validInt(), which is

  preg_replace('/[^\-\d]/', '', $input)

so it only removes the colon and splices the two numbers into 150028.
Logs.Line is smallint(5) unsigned, max 65535, so the insert died with

  PDOException SQLSTATE[22003]: Out of range value for column 'Line'
    includes/logger.php:438 <- ajax/log.php:81

and the request returned 500.  The endpoint failed on the very error it
was sent to report, so a js error surfaced as "AJAX execution error:
Internal Server Error [500]" instead of a log entry.  Any Firefox error
past roughly line 655 hits this, on any view.

Parse the leading line number instead and clamp it to what the column
holds.  validInt() is left alone; it is used widely and its callers rely
on the strip-everything behaviour, the defect is handing it a line:column
string.

Checked with an assert script over 1500:28, 1789:8, a plain 1500, an
over-range 70000 and 99999:1, empty, non-numeric, and array input; the
first three give the line, the next two clamp to 65535, the rest stay NULL.
2026-08-27 19:54:42 -04:00
..
2019-02-22 09:19:07 -05:00
2023-04-23 13:15:11 -04:00
2018-12-29 09:52:58 -05:00