Skip to content

Commit 92a43cf

Browse files
authored
Merge pull request #76 from Componolit/issue_75
Add reproducer for issue 75
2 parents a952f04 + b0766a1 commit 92a43cf

27 files changed

+2799
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
obj

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "examples/contrib/FreeRTOS-Plus-TCP"]
2+
path = examples/contrib/FreeRTOS-Plus-TCP
3+
url = https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git

examples/Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
COMMON_CFLAGS = -g -Wno-pointer-to-int-cast -Dstatic= -fsanitize=address
2+
LDFLAGS = -lasan
3+
4+
FREERTOS_PLUS_TCP_PATH = contrib/FreeRTOS-Plus-TCP
5+
6+
VPATH += src $(FREERTOS_PLUS_TCP_PATH) $(FREERTOS_PLUS_TCP_PATH)/portable/BufferManagement
7+
8+
DUMMY := $(shell mkdir -p obj)
9+
VERBOSE ?= @
10+
11+
VULNS = vuln_75
12+
13+
all: $(addprefix obj/,$(VULNS))
14+
$(VERBOSE)for t in $<; do echo "Running $$t"; ./$$t; done
15+
16+
obj/vuln_75: \
17+
obj/FreeRTOS_ARP.o \
18+
obj/FreeRTOS_DHCP.o \
19+
obj/FreeRTOS_IP.o \
20+
obj/FreeRTOS_UDP_IP.o \
21+
obj/FreeRTOS_Sockets.o \
22+
obj/BufferAllocation_1.o \
23+
obj/freertos_10_0_1_helper.o \
24+
obj/list.o \
25+
obj/port.o \
26+
obj/queue.o \
27+
obj/vuln_75.o
28+
obj/vuln_75: \
29+
CFLAGS += \
30+
-Iinclude/FreeRTOS-10.0.1 \
31+
-I$(FREERTOS_PLUS_TCP_PATH) \
32+
-I$(FREERTOS_PLUS_TCP_PATH)/include \
33+
-I$(FREERTOS_PLUS_TCP_PATH)/portable/Compiler/GCC \
34+
$(COMMON_CFLAGS)
35+
obj/vuln_75:
36+
$(VERBOSE)$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $^ -Wl,--end-group
37+
38+
obj/%.o: %.c
39+
$(VERBOSE)$(CC) $(CFLAGS) -o $@ -c $<
40+
41+
clean:
42+
$(VERBOE)rm -rf obj

examples/contrib/FreeRTOS-Plus-TCP

Submodule FreeRTOS-Plus-TCP added at 08a6e60
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef INC_FREERTOS_H
2+
#define INC_FREERTOS_H
3+
4+
#include <stddef.h>
5+
6+
#define pdMS_TO_TICKS( xTimeInMs ) 0
7+
8+
#include <list.h>
9+
#include <queue.h>
10+
11+
#define pdFALSE 0
12+
#define pdTRUE 1
13+
14+
#define configASSERT(x)
15+
16+
typedef int32_t BaseType_t;
17+
typedef uint32_t UBaseType_t;
18+
typedef uint32_t TickType_t;
19+
typedef uint32_t TimeOut_t;
20+
21+
#endif // INC_FREERTOS_H
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef FREERTOS_IP_CONFIG_H
2+
#define FREERTOS_IP_CONFIG_H
3+
4+
#define ipconfigNETWORK_MTU 1500
5+
6+
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 1
7+
#define ipconfigEVENT_QUEUE_LENGTH 6
8+
9+
#define ipconfigUSE_TCP 0
10+
#define ipconfigUSE_TCP_WIN 0
11+
#define ipconfigUSE_LINKED_RX_MESSAGES 0
12+
#define ipconfigMAX_IP_TASK_SLEEP_TIME 0
13+
#define ipconfigIP_TASK_PRIORITY 0
14+
#define ipconfigIP_TASK_STACK_SIZE_WORDS 100
15+
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS 1000
16+
17+
#define ipconfigUSE_DHCP 1
18+
#define ipconfigUSE_DNS 0
19+
20+
#define ipconfigRAND32() 42
21+
22+
#define portMAX_DELAY 0
23+
#define configTICK_RATE_HZ 1000
24+
25+
#endif // !FREERTOS_IP_CONFIG_H
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
typedef uint64_t EventBits_t;
4+
typedef uint64_t EventGroupHandle_t;
5+
6+
#define xEventGroupSetBits(x, y)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
typedef uint64_t ListItem_t;
4+
typedef uint64_t List_t;
5+
6+
#define vListInsertEnd(x, y)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef INC_QUEUE_H
2+
#define INC_QUEUE_H
3+
4+
#define pdFAIL pdFALSE
5+
#define pdPASS pdTRUE
6+
7+
typedef uint64_t xQueueItem;
8+
typedef uint64_t *QueueHandle_t;
9+
10+
#define xQueueReceive(a, b, c)
11+
#define xQueueSendToBack(a, b, c) pdPASS
12+
#define xQueueSendToBackFromISR(a, b, c) pdPASS
13+
#define vQueueDelete(q)
14+
#define xQueueCreate(a, b) NULL
15+
16+
#endif // INC_QUEUE_H

examples/include/FreeRTOS-10.0.1.old/semphr.h

Whitespace-only changes.

0 commit comments

Comments
 (0)