+2017-07-06 Bruno Haible <bruno@clisp.org>
+
+ uninorm/filter: Fix use-after-free bug.
+ * lib/uninorm/uninorm-filter.c (uninorm_filter_write): Maintain
+ sortbuf == filter->sortbuf invariant.
+ Reported by Coverity.
+
2017-07-06 Bruno Haible <bruno@clisp.org>
glob: Fix more memory leaks.
{
/* Cache sortbuf and sortbuf_count in local register variables. */
- struct ucs4_with_ccc * const sortbuf = filter->sortbuf;
+ struct ucs4_with_ccc *sortbuf = filter->sortbuf;
size_t sortbuf_count = filter->sortbuf_count;
int i;
if (filter->sortbuf != filter->sortbuf_preallocated)
free (filter->sortbuf);
filter->sortbuf = new_sortbuf;
+ /* Update cache of filter->sortbuf. */
+ sortbuf = filter->sortbuf;
}
- filter->sortbuf[sortbuf_count].code = uc;
- filter->sortbuf[sortbuf_count].ccc = ccc;
+ sortbuf[sortbuf_count].code = uc;
+ sortbuf[sortbuf_count].ccc = ccc;
sortbuf_count++;
}