Program: 33337
Project: 33337
Buggy source:
public int decode(byte[] pix,int offset,int len) throws Exception {
  T4CodeHuffmanTreeNode blackNodes=T4BlackCodeHuffmanTreeNode.getInstance();
  T4CodeHuffmanTreeNode whiteNodes=T4WhiteCodeHuffmanTreeNode.getInstance();
  T4CodeHuffmanTreeNode currNode=whiteNodes;
  byte cur=input[byteOffset];
  int endOffset=byteOffset + this.len;
  int runLen=0;
  int remaining=scanLineWidth;
  boolean isWhiteCode=true;
  while (true) {
    if (((cur >> bitOffset) & 0x01) == 0) {
      if (currNode.left() != null) {
        currNode=currNode.left();
        bitOffset--;
        if (bitOffset < 0) {
          bitOffset=7;
          byteOffset++;
          if (byteOffset >= endOffset)           break;
          cur=input[byteOffset];
        }
      }
 else {
        runLen+=currNode.value();
        if (currNode.value() <= 63) {
          if (runLen > remaining)           runLen=remaining;
          remaining-=runLen;
          if (isWhiteCode) {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,0,len);
            if (remaining != 0) {
              currNode=blackNodes;
              isWhiteCode=false;
            }
 else {
              currNode=whiteNodes;
              isWhiteCode=true;
            }
          }
 else {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,1,len);
            currNode=whiteNodes;
            isWhiteCode=true;
          }
          if (remaining == 0) {
            remaining=scanLineWidth;
            if (bitOffset != 7) {
              byteOffset++;
              bitOffset=7;
              if (byteOffset >= endOffset)               break;
              cur=input[byteOffset];
            }
          }
          runLen=0;
        }
 else {
          if (isWhiteCode)           currNode=whiteNodes;
 else           currNode=blackNodes;
        }
      }
    }
 else     if (((cur >> bitOffset) & 0x01) == 1) {
      if (currNode.right() != null) {
        currNode=currNode.right();
        bitOffset--;
        if (bitOffset < 0) {
          bitOffset=7;
          byteOffset++;
          if (byteOffset >= endOffset)           break;
          cur=input[byteOffset];
        }
      }
 else {
        runLen+=currNode.value();
        if (currNode.value() <= 63) {
          if (runLen > remaining)           runLen=remaining;
          remaining-=runLen;
          if (isWhiteCode) {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,0,len);
            if (remaining != 0) {
              currNode=blackNodes;
              isWhiteCode=false;
            }
 else {
              currNode=whiteNodes;
              isWhiteCode=true;
            }
          }
 else {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,1,len);
            currNode=whiteNodes;
            isWhiteCode=true;
          }
          if (remaining == 0) {
            remaining=scanLineWidth;
            if (bitOffset != 7) {
              byteOffset++;
              bitOffset=7;
              if (byteOffset >= endOffset)               break;
              cur=input[byteOffset];
            }
          }
          runLen=0;
        }
 else {
          if (isWhiteCode)           currNode=whiteNodes;
 else           currNode=blackNodes;
        }
      }
    }
  }
  return uncompressedBytes;
}

Fixed version (ground truth):
public int decode(byte[] pix,int offset,int len) throws Exception {
  T4CodeHuffmanTreeNode blackNodes=T4BlackCodeHuffmanTreeNode.getInstance();
  T4CodeHuffmanTreeNode whiteNodes=T4WhiteCodeHuffmanTreeNode.getInstance();
  T4CodeHuffmanTreeNode currNode=whiteNodes;
  byte cur=input[byteOffset];
  int endOffset=byteOffset + this.len;
  destByteOffset=offset;
  int runLen=0;
  int remaining=scanLineWidth;
  boolean isWhiteCode=true;
  while (true) {
    if (((cur >> bitOffset) & 0x01) == 0) {
      if (currNode.left() != null) {
        currNode=currNode.left();
        bitOffset--;
        if (bitOffset < 0) {
          bitOffset=7;
          byteOffset++;
          if (byteOffset >= endOffset)           break;
          cur=input[byteOffset];
        }
      }
 else {
        runLen+=currNode.value();
        if (currNode.value() <= 63) {
          if (runLen > remaining)           runLen=remaining;
          remaining-=runLen;
          if (isWhiteCode) {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,0,len);
            if (remaining != 0) {
              currNode=blackNodes;
              isWhiteCode=false;
            }
 else {
              currNode=whiteNodes;
              isWhiteCode=true;
            }
          }
 else {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,1,len);
            currNode=whiteNodes;
            isWhiteCode=true;
          }
          if (remaining == 0) {
            remaining=scanLineWidth;
            if (bitOffset != 7) {
              byteOffset++;
              bitOffset=7;
              if (byteOffset >= endOffset)               break;
              cur=input[byteOffset];
            }
          }
          runLen=0;
        }
 else {
          if (isWhiteCode)           currNode=whiteNodes;
 else           currNode=blackNodes;
        }
      }
    }
 else     if (((cur >> bitOffset) & 0x01) == 1) {
      if (currNode.right() != null) {
        currNode=currNode.right();
        bitOffset--;
        if (bitOffset < 0) {
          bitOffset=7;
          byteOffset++;
          if (byteOffset >= endOffset)           break;
          cur=input[byteOffset];
        }
      }
 else {
        runLen+=currNode.value();
        if (currNode.value() <= 63) {
          if (runLen > remaining)           runLen=remaining;
          remaining-=runLen;
          if (isWhiteCode) {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,0,len);
            if (remaining != 0) {
              currNode=blackNodes;
              isWhiteCode=false;
            }
 else {
              currNode=whiteNodes;
              isWhiteCode=true;
            }
          }
 else {
            destByteOffset=outputRunLen(pix,destByteOffset,runLen,scanLineWidth,1,len);
            currNode=whiteNodes;
            isWhiteCode=true;
          }
          if (remaining == 0) {
            remaining=scanLineWidth;
            if (bitOffset != 7) {
              byteOffset++;
              bitOffset=7;
              if (byteOffset >= endOffset)               break;
              cur=input[byteOffset];
            }
          }
          runLen=0;
        }
 else {
          if (isWhiteCode)           currNode=whiteNodes;
 else           currNode=blackNodes;
        }
      }
    }
  }
  return uncompressedBytes;
}