#2135 closed defect (fixed)

times() and _times() are subject to integer overflows

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: low Milestone: 5.1
Component: posix Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

The clock_t type is defined as unsigned long for RTEMS in Newlib. With a 1ms clock tick an overflow happens after 7 days on 32-bit long targets.

Change History (10)

comment:1 Changed on 07/30/13 at 13:19:19 by Joel Sherrill

Replying to comment:1:

Replying to comment:0:

The clock_t type is defined as unsigned long for RTEMS in Newlib. With a 1ms
clock tick an overflow happens after 7 days on 32-bit long targets.

I mean 7 weeks.

CentOS 6.4 has this has clock_t as clock_t which appears to be a long int.
So no better.

comment:2 Changed on 11/24/14 at 18:58:28 by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:3 Changed on 12/18/14 at 12:29:27 by Sebastian Huber

Milestone: 4.115.0
Priority: normallow

comment:4 Changed on 08/14/17 at 00:41:59 by Chris Johns

Milestone: 5.04.12.0
Version: 4.114.12

Moving to 4.12.0. Please update and move if this is not valid.

comment:5 Changed on 08/24/17 at 06:55:23 by Sebastian Huber

This should change to at least 64-bit just like time_t.

comment:6 Changed on 08/25/17 at 12:37:43 by Sebastian Huber <sebastian.huber@…>

In 4f364ef/rtems-source-builder:

4.12: Change clock_t to 64-bit

Update #2135.
Update #3111.

comment:7 Changed on 08/25/17 at 13:37:31 by Sebastian Huber

Owner: changed from Joel Sherrill to Sebastian Huber
Status: newaccepted

comment:8 Changed on 09/06/17 at 05:43:52 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: acceptedclosed

In 731e68a3/rtems:

Fix integer overflow problems in times()

An integer overflow may still happen, however, only after 68 years of
system uptime.

Close #2135.

comment:9 Changed on 10/16/17 at 06:17:09 by Sebastian Huber

Component: scoreposix

comment:10 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.