Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | An attempt to fix a "double free crash" from the previous check-in. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | markdown-footnotes |
Files: | files | file ages | folders |
SHA3-256: |
18c9d1036830498093e3ebcb88f2ab9a |
User & Date: | george 2022-02-08 14:09:19 |
Context
2022-02-09
| ||
19:29 | Fix a bug in the blob_reserve() function that was introduced by [1243bf39996b8a]. The current mainline is not affected because this function is not used anywhere. However it was causing memory corruption on the 'markdown-footnotes' branch since it was employed in [544df852b2d9a1]. ... (check-in: 7283ae6e user: george tags: markdown-footnotes) | |
2022-02-08
| ||
14:09 | An attempt to fix a "double free crash" from the previous check-in. ... (check-in: 18c9d103 user: george tags: markdown-footnotes) | |
14:04 |
If several footnotes are defined with the same label then join them into a single footnote. Text from each definition becomes an item in the list. This solution makes such situations noticable for the usual case (when this is an oversight) but also not obtrusive for the rare cases (when this is intentional). The list is provided with a special class to enable styling via skin customization. This check-in is known to cause crash, see the forthcoming check-in. ... (check-in: 544df852 user: george tags: markdown-footnotes) | |
Changes
Changes to src/markdown.c.
︙ | ︙ | |||
2608 2609 2610 2611 2612 2613 2614 | } /* move redundant elements to the end of array and truncate/resize */ qsort(fn, rndr.notes.nLbled, sizeof(struct footnote), cmp_footnote_id); i = rndr.notes.nLbled; while( i && !blob_size(&fn[i-1].id) ){ i--; } rndr.notes.nLbled = i; | > > > > | > > > > > > | 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 | } /* move redundant elements to the end of array and truncate/resize */ qsort(fn, rndr.notes.nLbled, sizeof(struct footnote), cmp_footnote_id); i = rndr.notes.nLbled; while( i && !blob_size(&fn[i-1].id) ){ i--; } rndr.notes.nLbled = i; blob_resize( &rndr.notes.all, i*sizeof(struct footnote) ); /* FIXME: It was expected to work via truncation: * * blob_truncate( &rndr.notes.all, i*sizeof(struct footnote) ); * * but that way it crashes with * * free(): double free detected in tcache 2 * * This is strange. */ } assert( COUNT_FOOTNOTES(&rndr.notes.all) == rndr.notes.nLbled ); fn = CAST_AS_FOOTNOTES(&rndr.notes.all); for(i=0; i<rndr.notes.nLbled; i++){ fn[i].index = i; } assert( rndr.notes.nMarks==0 ); |
︙ | ︙ |