[PATCH 0/2] Fix crashes seen on subpages of https://www.pythontutorial.net/
There are input type="button" without value there, do not crash. The main repo seems not to have a pull request functionality, so I am using the good old git format-patch way, so it can be applied via git am. Andreas Kemnade (2): do not crash at input tags which do neither produce resources or embeds form input: try to find defaults for buttons without a value src/form.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.47.3
new Embed(resource) crashes if resource is NULL. Ignore the tag in such cases. This came to light during parsing of a button tag without a value. --- src/form.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/form.cc b/src/form.cc index e2f0c1c2..038b94f3 100644 --- a/src/form.cc +++ b/src/form.cc @@ -551,7 +551,7 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize) init_str = value; } - if (inp_type != DILLO_HTML_INPUT_UNKNOWN) { + if ((inp_type != DILLO_HTML_INPUT_UNKNOWN) && (resource || embed)) { if (!embed) embed = new Embed(resource); -- 2.47.3
This also prevents crashes due to resource == NULL Examples can be found at https://www.pythontutorial.net/python-oop/ --- src/form.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/form.cc b/src/form.cc index 038b94f3..e9b9c984 100644 --- a/src/form.cc +++ b/src/form.cc @@ -538,7 +538,8 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize) } else if (!dStrAsciiCasecmp(type, "button")) { inp_type = DILLO_HTML_INPUT_BUTTON; if (value) { - init_str = value; + label = value ? value : name ? name : "Submit"; + init_str = dStrdup(label); resource = factory->createLabelButtonResource(init_str); } } else { -- 2.47.3
Teilnehmer (1)
-
Andreas Kemnade