diff options
author | correctmost <[email protected]> | 2024-01-08 18:08:38 -0500 |
---|---|---|
committer | raveit65 <[email protected]> | 2024-01-31 12:22:25 +0100 |
commit | d901a9df71935fc98c0ec59bd27658670f3740ee (patch) | |
tree | 7904c306565b9ea08431309979df94a2a18fbf65 /backend/epub/epub-document.c | |
parent | 0014a629ef701a4786e73e16cf0736410e81976b (diff) | |
download | atril-d901a9df71935fc98c0ec59bd27658670f3740ee.tar.bz2 atril-d901a9df71935fc98c0ec59bd27658670f3740ee.tar.xz |
epub: Avoid crash when index list has extraneous entry
This commit also fixes an incorrect sizeof call detected by
AddressSanitizer.
Closes #599
Diffstat (limited to 'backend/epub/epub-document.c')
-rw-r--r-- | backend/epub/epub-document.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c index 3ea7bdaa..1ac13e60 100644 --- a/backend/epub/epub-document.c +++ b/backend/epub/epub-document.c @@ -1044,7 +1044,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu } if ( xmlStrcmp(itemrefptr->name,(xmlChar*)"itemref") == 0) { - contentListNode *newnode = g_malloc0(sizeof(newnode)); + contentListNode *newnode = g_malloc0(sizeof(*newnode)); newnode->key = (gchar*)xml_get_data_from_node(itemrefptr,XML_ATTRIBUTE,(xmlChar*)"idref"); if ( newnode->key == NULL ) { @@ -1626,7 +1626,7 @@ page_set_function(linknode *Link, GList *contentList) contentListNode *pagedata; guint flag=0; - while (!flag) { + while (!flag && listiter) { pagedata = listiter->data; if (link_present_on_page(Link->pagelink, pagedata->value)) { flag=1; |