Motion - Bug Report 2005x 02x 24x 135548
You are here: Foswiki>Motion Web>BugReports>BugReport2005x02x24x135548 (28 Feb 2005, RaphaelAssenat)Edit Attach

BUG: Floating Point Exception

To reduce the bandwidth consumed while monitoring my cam using motion's mini-http server, I tried setting webcam_maxrate 0.1 in the config file. As soon as I connected to motion's server, motion exited with a Floating Point Exception. Setting webcam_maxrate to an integer value fixes the problem.

Test case

Enable the webcam server and set webcam_maxrate to 0.1. Connect to the server and motion should quit with an FPU exception.

Environment

Motion version: 3.1.18
ffmpeg version:  
Shared libraries:  
Server OS: Linux Debian, kernel 2.6.10

-- RaphaelAssenat - 24 Feb 2005

Follow up

I read the source and discovered that atoi is used to convert the value from the config file to an integer. atoi stops when it encounters the '.' character and returns 0. I tried setting webcam_maxrate to 0 and it still causes a floating point exception when connecting to the server.

-- RaphaelAssenat - 24 Feb 2005

Ok, I browsed the source a little more, and the crash comes from webcam.c:200

if (list->tmpfile==NULL && (curtime-list->last)>=1000000L/fps) {

webcam_maxrate value is passed to the webcam_add_write function as the fps parameter, and causes a division by 0. I suggest adding a simple test in the function to prevent fps from beeing 0.

-- RaphaelAssenat - 24 Feb 2005

Fix record

I guess that your fix has not sense at all , because if you want to specify a max_framerate lower that 1 that motion doesn't allow, why motion should check if you enter a value lower that 1 and set fps to 1 ?

-- AngelCarpintero - 25 Feb 2005

I agree that a max_framerate lower than 1 makes no sense, but attempting to doing so raises a floating point exception. I beleive that motion should not crash because of invalid values in the config file. Maybe printing something like 'Invalid value in config at line xx' and exiting cleanly would be better?

-- RaphaelAssenat - 28 Feb 2005

Ok, I saw in the 3.2.1_snap2 release announcement that doing range checking on configuration values is planned. This is a better solution.

-- RaphaelAssenat - 28 Feb 2005
Topic revision: r5 - 28 Feb 2005, RaphaelAssenat
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.