Daniel-Glucksman / JBig2Decoder.NET

A .Net Implementation of the JPedal JBig2 Decoder
MIT License
10 stars 4 forks source link

Index out of bouds #9

Open GBriotti opened 3 years ago

GBriotti commented 3 years ago

Just received this, parsing a PDF:

Index out of bounds. Generated exception: 'System.IndexOutOfRangeException' in JBig2Decoder.dll

I'm investigating more in deep...

GBriotti commented 3 years ago

OK. It seems related to JBig2Image.cs. The method readbitmap() has this snippet of code:

if (typicalPredictionGenericDecodingOn) { int bit = arithmeticDecoder.DecodeBit(ltpCX, arithmeticDecoder.genericRegionStats); if (bit != 0) { ltp = !ltp; } if (ltp) { DuplicateRow(row, row - 1); continue; } }

where ltp is true and row is zero... thus duplicaterow fails...

GBriotti commented 3 years ago

Well, it seems that is the same issue resolved by the pull request Update JBig2Image.cs

Applying the corrections it works for me!