[ARGUS] tv_nsec potentially invalid value

Ming Fu via Argus-info argus-info at lists.andrew.cmu.edu
Mon Nov 25 21:52:00 EST 2024


Hi,

I noticed a few argus 5.0.0 unexpected stops. Very hard to reproduce, but I think the problem is here:

https://github.com/openargus/argus/blob/main/argus/ArgusSource.c#L4856

         tts->tv_sec  = tvp->tv_sec + 0;
         tts->tv_nsec = (tvp->tv_usec * 1000) + 250000000;
         if (tts->tv_nsec > 1000000000) {
            tts->tv_sec++;
            tts->tv_nsec -= 1000000000;
         }
         if ((retn = pthread_cond_timedwait(&stask->cond, &stask->lock, tts))) {
         ....

The error log is:
argus-rt[2591]: ArgusSourceProcess: pthread_cond_timedwait() error EINVAL

The compare at line 4856 should be         
         if (tts->tv_nsec >= 1000000000) {

1000000000 is an invalid nsec number.

Regards,
Ming


More information about the argus mailing list