mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-06-22 20:50:06 -04:00
MonitorStream::processCommand computed buffer_level by dividing by temp_image_buffer_count (and via MOD_ADD modulo) while only guarding on playback_buffer. processCommand runs on the command_processor thread, started in runStream before temp_image_buffer_count is assigned from playback_buffer. In that window temp_image_buffer_count is still 0 while playback_buffer is already > 0, so a command arriving then divided by zero and raised SIGFPE, crashing nph-zms. Extract the percentage math into MonitorStreamBufferLevel which returns 0 when the buffer count is not positive, and add Catch2 coverage for the zero-count and wrap-around cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.0 KiB
2.0 KiB