google / astc-codec

A software ASTC decoder implementation which supports the ASTC LDR profile
Apache License 2.0
69 stars 30 forks source link

codec.cc size check incorrect? #12

Open EvilTrev opened 4 years ago

EvilTrev commented 4 years ago
if (kBytesPerPixelUNORM8 * width > out_buffer_stride ||
     out_buffer_stride * height < out_buffer_size) {
          // Output buffer too small.
          return false;
     }

If I pass in a buffer with exactly the right size, this would fail. If I passed in a buffer much larger than required, it would also fail? Seems like the logic is inverted on the second condition - unless I'm missing something?

wwylele commented 3 years ago

Also found this myself. Agreed that this looks like a mistake.