diff options
author | correctmost <[email protected]> | 2024-01-08 18:08:38 -0500 |
---|---|---|
committer | raveit65 <[email protected]> | 2024-01-31 11:42:54 +0100 |
commit | e254cd9eb51eecfeb5ffa88cf57133709db19291 (patch) | |
tree | bb5096f090c676ea3588ee3720982825acd83836 /backend/epub/epub-document.c | |
parent | 1d379fb767df95a6ea2643de75c330e01a15c0a4 (diff) | |
download | atril-e254cd9eb51eecfeb5ffa88cf57133709db19291.tar.bz2 atril-e254cd9eb51eecfeb5ffa88cf57133709db19291.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 38ab4c83..d3fdf586 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; |