2025-01-30 07:10 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002888LibDOM[All Projects] Generalpublic2025-01-14 13:39
Reporterأحمد المحمودي 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSLinuxOS Version
Summary0002888: Dix teans[osed calloc args
DescriptionSame as 0002885
TagsNo tags attached.
Fixed in CI build #
Reported in CI build #
Attached Files
  • patch file icon fix-calloc-args.patch (1,963 bytes) 2025-01-09 09:31 -
    Description: fix transposed calloc args
    Author: أحمد المحمودي (Ahmed El-Mahmoudy) <aelmahmoudy@users.sourceforge.net>
    Bug: https://bugs.netsurf-browser.org/mantis/view.php?id=2885
    Forwarded: https://bugs.netsurf-browser.org/mantis/file_download.php?file_id=751&type=bug
    Index: libdom/bindings/xml/expat_xmlparser.c
    ===================================================================
    --- libdom.orig/bindings/xml/expat_xmlparser.c	2025-01-09 09:03:48.883278479 +0100
    +++ libdom/bindings/xml/expat_xmlparser.c	2025-01-09 09:43:54.130555298 +0100
    @@ -484,7 +484,7 @@
     
     	UNUSED(int_enc);
     
    -	parser = calloc(sizeof(*parser), 1);
    +	parser = calloc(1, sizeof(*parser));
     	if (parser == NULL) {
     		msg(DOM_MSG_CRITICAL, mctx, "No memory for parser");
     		return NULL;
    Index: libdom/src/core/node.c
    ===================================================================
    --- libdom.orig/src/core/node.c	2025-01-09 09:03:48.891278374 +0100
    +++ libdom/src/core/node.c	2025-01-09 09:47:12.527863638 +0100
    @@ -2379,7 +2379,7 @@
     	if (t == NULL) {
     		/* Create the event target list */
     		size = 64;
    -		t = calloc(sizeof(*t), size);
    +		t = calloc(size, sizeof(*t));
     		if (t == NULL) {
     			return DOM_NO_MEM_ERR;
     		}
    Index: libdom/src/html/html_document.c
    ===================================================================
    --- libdom.orig/src/html/html_document.c	2025-01-09 09:03:48.895278321 +0100
    +++ libdom/src/html/html_document.c	2025-01-09 09:46:43.292259826 +0100
    @@ -134,13 +134,13 @@
     	doc->cookie = NULL;
     	doc->body = NULL;
     
    -	doc->memoised = calloc(sizeof(dom_string *), hds_COUNT);
    +	doc->memoised = calloc(hds_COUNT, sizeof(dom_string *));
     	if (doc->memoised == NULL) {
     		error = DOM_NO_MEM_ERR;
     		goto out;
     	}
    -	doc->elements = calloc(sizeof(dom_string *),
    -			DOM_HTML_ELEMENT_TYPE__COUNT);
    +	doc->elements = calloc(DOM_HTML_ELEMENT_TYPE__COUNT,
    +			sizeof(dom_string *));
     	if (doc->elements == NULL) {
     		error = DOM_NO_MEM_ERR;
     		goto out;
    
    patch file icon fix-calloc-args.patch (1,963 bytes) 2025-01-09 09:31 +

-Relationships
has duplicate 0002889new Fix transposed calloc args 
+Relationships

+Notes

-Issue History
Date Modified Username Field Change
2025-01-09 09:31 أحمد المحمودي New Issue
2025-01-09 09:31 أحمد المحمودي File Added: fix-calloc-args.patch
2025-01-09 09:37 أحمد المحمودي Issue cloned: 0002889
2025-01-09 09:37 أحمد المحمودي Relationship added has duplicate 0002889
2025-01-14 13:39 Michael Orlitzky Note Added: 0002470
+Issue History