Package: flex
Version: 2.5.39-8

The buf_append function will check if the current buf size needs
additional memory to append the new element(s).
n_alloc seems for how many ELEMENTS after append the new element(s),
so it is just a count number, and do not need to multiply with the
element size.

File: buf.c: http://sources.debian.net/src/flex/2.5.39-8/buf.c/#L245
241    /* May need to alloc more. */
242    if (n_elem + buf->nelts > buf->nmax) {
243
244        /* exact amount needed... */
245        n_alloc = (n_elem + buf->nelts) * buf->elt_size;
246
247        /* ...plus some extra */
248        if (((n_alloc * buf->elt_size) % 512) != 0
249            && buf->elt_size < 512)
250            n_alloc +=
251                (512 -
252                 ((n_alloc * buf->elt_size) % 512)) /
253                buf->elt_size;

Check line 245, n_alloc should direct equals n_elem + buf->nelts, the
additional multiply with buf->elt_size should be a mistake, because in
line 248 and below, when checking the 512 boundaries, the n_alloc will
multiply with the buf->elt_size.

B.R.
Howard Gong


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to