Fix floating point exception with cwebp -progress
Adds a test of enc->mb_h_ to VP8IteratorProgress() to avoid a division by zero. Fixes issue #121. Original patch from even rouault (even dot rouault at gmail dot com). Change-Id: Ie5fcc1821860c0a9366d5aa11f3aded4f5b98ed7
This commit is contained in:
parent
a89835d33a
commit
f2cee06708
@ -72,7 +72,9 @@ void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it) {
|
||||
int VP8IteratorProgress(const VP8EncIterator* const it, int delta) {
|
||||
VP8Encoder* const enc = it->enc_;
|
||||
if (delta && enc->pic_->progress_hook) {
|
||||
const int percent = it->percent0_ + delta * it->y_ / (enc->mb_h_ - 1);
|
||||
const int percent = (enc->mb_h_ <= 1)
|
||||
? it->percent0_
|
||||
: it->percent0_ + delta * it->y_ / (enc->mb_h_ - 1);
|
||||
return WebPReportProgress(enc->pic_, percent, &enc->percent_);
|
||||
}
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user