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
1317 for (ln = 0; lst && lst[ln]; ln++)1317 for (ln = 0; lst && lst[ln]; ln++)
1318 /**/;1318 /**/;
1319 1319
1320#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
1321 if (ln >= 100) {
1322 talloc_free(add);
1323 return 0;
1324 }
1325#endif
1326
1320 lst = talloc_realloc(NULL, lst, char *, n + ln + 1);1327 lst = talloc_realloc(NULL, lst, char *, n + ln + 1);
1321 1328
1322 if (pre) {1329 if (pre) {
@@ -1447,6 +1454,10 @@ static int parse_str_list_impl(struct mp_log *log, const m_option_t *opt, · 124 unmodified lines
1447 n = 0;1454 n = 0;
1448 1455
1449 while (1) {1456 while (1) {
1457#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
1458 if (n >= 100)
1459 break;
1460#endif
1450 struct bstr el = get_nextsep(&str, separator, 1);1461 struct bstr el = get_nextsep(&str, separator, 1);
1451 res[n] = bstrdup0(NULL, el);1462 res[n] = bstrdup0(NULL, el);
1452 n++;1463 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