sardemff7 / libnkutils

Miscellaneous utilities
7 stars 1 forks source link

token: Use no SI prefix for zero value #1

Closed wentasah closed 6 years ago

wentasah commented 6 years ago

When zero value was passed to _nk_token_list_append_prettify(), the search for a proper SI prefix in _nk_token_prefixes_si_small run out of array bounds. In my case, it manifested as bitrate string of "0(null)b/s".

This is now fixed by explicit check for zero value and setting of empty prefix in this case.

Signed-off-by: Michal Sojka michal.sojka@cvut.cz

codecov[bot] commented 6 years ago

Codecov Report

Merging #1 into master will decrease coverage by 0.02%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #1      +/-   ##
==========================================
- Coverage   79.06%   79.03%   -0.03%     
==========================================
  Files          18       18              
  Lines        2154     2156       +2     
==========================================
+ Hits         1703     1704       +1     
- Misses        451      452       +1
Impacted Files Coverage Δ
src/token.c 87% <66.66%> (-0.14%) :arrow_down:

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 70a5cdb...85e8d3d. Read the comment docs.

sardemff7 commented 6 years ago

Thanks a lot, added a test case in 9015af623c88d17e7c361b955944ec006b77224d.