Skip to content

Commit f04a25d

Browse files
boxerabtlsa
authored andcommitted
add a few null checks
import->url was crashing the fuzzer, so I added a check here
1 parent 81d956b commit f04a25d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/stylesheet.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ css_error css__stylesheet_string_add(css_stylesheet *sheet, lwc_string *string,
3939
{
4040
uint32_t new_string_number; /* The string number count */
4141

42+
if (string == NULL)
43+
return CSS_BADPARM;
44+
4245
/* search for the string in the existing vector */
4346
for (new_string_number = 0;
4447
new_string_number < sheet->string_vector_c;
@@ -1151,7 +1154,9 @@ css_error css__stylesheet_rule_destroy(css_stylesheet *sheet, css_rule *rule)
11511154
{
11521155
css_rule_import *import = (css_rule_import *) rule;
11531156

1154-
lwc_string_unref(import->url);
1157+
if (import->url != NULL)
1158+
lwc_string_unref(import->url);
1159+
11551160
if (import->media != NULL) {
11561161
css__mq_query_destroy(import->media);
11571162
}

0 commit comments

Comments
 (0)