|
|
@@ -40,14 +40,16 @@ unsigned char FilterChainBase64::GetByte() { |
|
|
|
|
|
|
|
while(true) { // Search for our startup string or get out. |
|
|
|
|
|
|
|
try { // Try this... |
|
|
|
try { // Try this...
|
|
|
|
ValidBuffer = false; // No valid buffer yet. |
|
|
|
x=FilterChain::GetByte(); // Get the next byte from source. |
|
|
|
} // If we get the empty signal |
|
|
|
// here, we've failed to match. |
|
|
|
catch(Empty) { // If so - and we haven't |
|
|
|
if(0==ScanIx) throw Empty("FilterChainBase64: No more data"); // started then just throw Empty. |
|
|
|
x=Base64Start[ScanIx]-1; // If we did start then make |
|
|
|
} // sure we won't match below. |
|
|
|
if(0==ScanIx) throw Empty("FilterChainBase64: No more data"); // started then just throw Empty.
|
|
|
|
State=DEQUEING;DequeIx=0; // If we have then we'll dequeue
|
|
|
|
return GetByte(); // it and throw when that's done |
|
|
|
} // because Buffer is not valid. |
|
|
|
|
|
|
|
// It's important that no empty's get beyond this point unless |
|
|
|
// we've got a match started. Otherwise we'll return corruption. |
|
|
@@ -55,7 +57,7 @@ unsigned char FilterChainBase64::GetByte() { |
|
|
|
if(x!=Base64Start[ScanIx]){ // If the byte doesnt match, |
|
|
|
// and we've started matching |
|
|
|
if(0!=ScanIx) { // the sequence then save the |
|
|
|
Buffer=x; // byte for later, change to |
|
|
|
Buffer=x; ValidBuffer=true; // byte for later, change to |
|
|
|
State=DEQUEING;DequeIx=0; // DEQUING mode, and return |
|
|
|
return GetByte(); // the first Dequeued byte. |
|
|
|
} |
|
|
@@ -165,9 +167,15 @@ unsigned char FilterChainBase64::GetByte() { |
|
|
|
|
|
|
|
} else { // When we're done with that part, |
|
|
|
State=SCANNING; // we set our mode back to scanning, |
|
|
|
ScanIx=DequeIx=0; // reset our indexes to start again, |
|
|
|
return Buffer; // and return the unmatching byte that |
|
|
|
} // got us to DEQUEING mode. |
|
|
|
ScanIx=DequeIx=0; // reset our indexes to start again,
|
|
|
|
|
|
|
|
// Here we either have a buffered byte to dequeue, or we ran out
|
|
|
|
// of data while attempting to match our startup sequence. If we
|
|
|
|
// have a vaild byte we return it. If not, we throw No More Data!
|
|
|
|
|
|
|
|
if(ValidBuffer) return Buffer;
|
|
|
|
else throw Empty("FilterChainBase64: No more data"); |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
@@ -444,7 +452,7 @@ unsigned char FilterChainQuotedPrintable::GetByte() { |
|
|
|
// FilterChainDefunker |
|
|
|
///////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
const char* DefunkerPreamble = "\n----[DEFUNKER]----\n";
|
|
|
|
const char* DefunkerPreamble = " ----[DEFUNKER]---- ";
|
|
|
|
|
|
|
|
// Patterns to match
|
|
|
|
|
|
|
@@ -476,9 +484,6 @@ unsigned char FilterChainDefunker::Store() { // While in Store mod |
|
|
|
unsigned char x; // we need a byte. |
|
|
|
|
|
|
|
try { |
|
|
|
if(DefunkerSize-10 < InputPosition) { |
|
|
|
cout << "watch this" << endl; |
|
|
|
} |
|
|
|
if(DefunkerSize <= InputPosition) |
|
|
|
throw Empty("FilterChainDefunker: No more data"); // Careful about the buffer. |
|
|
|
x = FilterChain::GetByte(); // Try getting the next byte |