Skip to content
Permalink
Browse files

check divide by zero, fixing #86

  • Loading branch information...
danielrh committed Apr 5, 2017
1 parent 82167c1 commit 7789d99ac156adfd7bbf66e7824bd3e948a74cf7
Showing with 12 additions and 4 deletions.
  1. +8 −2 src/lepton/uncompressed_components.hh
  2. +4 −2 src/vp8/model/model.hh
@@ -119,9 +119,15 @@ public:
int64_t max_cmp_bc = max_number_of_blocks;
max_cmp_bc *= header_[cmp].info_.bcv;
max_cmp_bc *= header_[cmp].info_.bch;
max_cmp_bc /= total_req_blocks;
if (total_req_blocks) {
max_cmp_bc /= total_req_blocks;
}
if (bc_allocated > max_cmp_bc) {
bc_allocated = max_cmp_bc - (max_cmp_bc % header_[cmp].info_.bch);
int rem = 0;
if (header_[cmp].info_.bch) {
rem = (max_cmp_bc % header_[cmp].info_.bch);
}
bc_allocated = max_cmp_bc - rem;
}
if (cmp == desired_cmp) {
framebuffer->init(header_[cmp].info_.bch,
@@ -254,8 +254,10 @@ public:
1020, 854, 854, 838, 1020, 838, 1020, 838
};
for (int coord = 0; coord < 64; ++coord) {
freqmax_[(int)color][coord] = (freqmax[coord] + quantization_table_[(int)color][coord] - 1)
/ quantization_table_[(int)color][coord];
freqmax_[(int)color][coord] = (freqmax[coord] + quantization_table_[(int)color][coord] - 1);
if (quantization_table_[(int)color][coord]) {
freqmax_[(int)color][coord] /= quantization_table_[(int)color][coord];
}
uint8_t max_len = uint16bit_length(freqmax_[(int)color][coord]);
bitlen_freqmax_[(int)color][coord] = max_len;
if (max_len > (int)RESIDUAL_NOISE_FLOOR) {

0 comments on commit 7789d99

Please sign in to comment.
You can’t perform that action at this time.