koodaamo / tnefparse

a TNEF decoding library written in python, without external dependencies
GNU Lesser General Public License v3.0
49 stars 37 forks source link

Handle truncated objects #42

Closed jrideout closed 5 years ago

codecov[bot] commented 5 years ago

Codecov Report

Merging #42 into master will increase coverage by 0.2%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #42     +/-   ##
=========================================
+ Coverage   90.73%   90.93%   +0.2%     
=========================================
  Files           5        5             
  Lines         982      982             
  Branches       97       97             
=========================================
+ Hits          891      893      +2     
+ Misses         69       68      -1     
+ Partials       22       21      -1
Impacted Files Coverage Δ
tnefparse/tnef.py 89.74% <100%> (+0.85%) :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 d704461...9862454. Read the comment docs.

jrideout commented 5 years ago

I came up with a cleaner way to do the same thing. Just assume the last 2 bytes of the object are the checksum. When that assumption is wrong, the checksum won't match anyway, so we still get the expected behavior. Also we are protected against unserializable data throwing exceptions due to the MIN_OBJ_SIZE check that occurs before initializing TNEFObject.

petri commented 5 years ago

Sounds good, thanks for spelling it out.