History

options/m_option: limit string list to 100 per operation for fuzzing

Kacper Michajłow committed 2 years ago

Commit 1f5a67d1 parent bc9d9821 file · +11 −0Browse files

Unified · Split

options/m_option.c+11−0
@@ -1317,6 +1317,13 @@ static int str_list_add(char **add, int n, void *dst, int pre) · 1316 unmodified lines
13171317 for (ln = 0; lst && lst[ln]; ln++)
13181318 /**/;
13191319
1320+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
1321+ if (ln >= 100) {
1322+ talloc_free(add);
1323+ return 0;
1324+ }
1325+#endif
1326+
13201327 lst = talloc_realloc(NULL, lst, char *, n + ln + 1);
13211328
13221329 if (pre) {
@@ -1447,6 +1454,10 @@ static int parse_str_list_impl(struct mp_log *log, const m_option_t *opt, · 124 unmodified lines
14471454 n = 0;
14481455
14491456 while (1) {
1457+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
1458+ if (n >= 100)
1459+ break;
1460+#endif
14501461 struct bstr el = get_nextsep(&str, separator, 1);
14511462 res[n] = bstrdup0(NULL, el);
14521463 n++;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t