aws / dcv-color-primitives

DCV Color Primitives Library
MIT No Attribution
31 stars 22 forks source link

Avoid reading invalid data for rgb to bgra conversion #67

Closed fabiosky closed 2 years ago

fabiosky commented 2 years ago

Issue #, if available:

Description of changes: Avoid reading invalid data for rgb to bgra conversion.

The function has two optimized path to load:

The paths rely on 1 byte (and respectively 2 bytes) of padding in the source buffer.

The assumption holds on all the lines is the image stride is greater than 3 width (resp. 3 width + 1), but could not hold on the last line, as the stride definition is 'distance from consecutive lines', but the last line has no following line, so we could not assume there is padding.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codecov-commenter commented 2 years ago

Codecov Report

Merging #67 (0548087) into master (d5c57a3) will increase coverage by 0.03%. The diff coverage is 100.00%.

:exclamation: Current head 0548087 differs from pull request most recent head ebb803c. Consider uploading reports for the commit ebb803c to get more accurate results

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   90.20%   90.24%   +0.03%     
==========================================
  Files           9        9              
  Lines        3195     3197       +2     
==========================================
+ Hits         2882     2885       +3     
+ Misses        313      312       -1     
Impacted Files Coverage Δ
tests/tests.rs 100.00% <ø> (ø)
src/convert_image/x86.rs 92.72% <100.00%> (+0.17%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d5c57a3...ebb803c. Read the comment docs.