Menu

#313 No array boundaries check in CDecoder::DecodeLz()

None
closed-accepted
nobody
None
5
2017-03-10
2017-03-10
No

In Rar2Decoder.cpp there's no check for boundaries of kLenStart and kLenDirectBits in lines 258 and 259. I have rar archive which crashes at line 258 due to sym = 0xfffffef1.

Discussion

  • Anton Kukoba

    Anton Kukoba - 2017-03-10

    most likely this is happening due to m_MainDecoder.DecodeSymbol() returns 0xFFFFFFFF from
    UInt32 Decode(TBitDecoder * bitStream)
    See HuffmanDecoder.h line 148.
    And then
    number -= kMatchNumber;
    gives UInt32 overflow. I.e. sym = 0xFFFFFFFF - kMatchNumber (which is 0x10E) => 0xFFFFFEF1 => accessing data behind boundaries of kLenStart and kLenDirectBits

     
  • Igor Pavlov

    Igor Pavlov - 2017-03-10

    Yes, that bug is already fixed in my code (that is not released still).
    But thanks for report anyway!

     
  • Igor Pavlov

    Igor Pavlov - 2017-03-10
    • status: open --> closed-accepted
    • Group: -->
     

Log in to post a comment.