#4350 closed defect (fixed)

Infinite loop in rtems-fdt.c

Reported by: niteesh Owned by: niteesh
Priority: normal Milestone:
Component: lib Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

The function rtems_fdt_load in file rtems-fdt.c contains an infinite loop.
https://git.rtems.org/rtems/tree/cpukit/libmisc/rtems-fdt/rtems-fdt.c#n583
The loop termination condition, size is not being decremented in the above line. Instead, the amount of bytes read is being decremented.

This bug is present in RTEMS 6 as well as 5

I have attached a patch below that fixes this.

Attachments (1)

0001-rtems-fdt-rtems-fdt.c-Fix-bug-in-loop-termination.patch (884 bytes) - added by niteesh on Mar 21, 2021 at 7:01:00 AM.

Download all attachments as: .zip

Change History (3)

comment:1 Changed on Mar 21, 2021 at 7:02:20 AM by niteesh

Owner: set to niteesh
Status: newaccepted

comment:2 Changed on Mar 21, 2021 at 11:40:25 AM by G S Niteesh Babu <niteesh.gs@…>

Resolution: fixed
Status: acceptedclosed

In 08f807e/rtems:

rtems-fdt/rtems-fdt.c: Fix bug in loop termination

The while loop, loops infinitely in case of raw FDT data.
The loop condition (size) is not modified during iterations.

Fixes #4350

Note: See TracTickets for help on using tickets.