lsws: prevent overflow in sws_init_context()
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Sun, 24 Apr 2011 23:17:08 +0000 (01:17 +0200)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Mon, 25 Apr 2011 20:45:19 +0000 (22:45 +0200)
commitbd2a3700c045201b043a0e812d932e9d4fc37e82
tree89ee8bc25a24b2ee908fec411ffca952b0e51e89
parent1d6c82d40541936fe67061a8374b5bae8fbc4cbb
lsws: prevent overflow in sws_init_context()

In the loop:
    for (i=0; i<dstH; i++) {
        int chrI= i*c->chrDstH / dstH;

when i*c->chrDstH > INT_MAX this leads to an integer overflow, which
results in a negative value for chrI and in out-of-buffer reads. The
overflow is avoided by forcing int64_t arithmetic by casting i to
int64_t.

Fix crash, and trac issue #72.

Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
libswscale/utils.c