Fixed segfault in jsc compression code
This commit is contained in:
parent
b961d03045
commit
88d8070db4
19
jsc.cpp
19
jsc.cpp
@ -112,7 +112,7 @@ QString JSC::decompress(Codeword const& bitvec){
|
|||||||
base[7] = base[6] + s*c*c*c*c*c*c;
|
base[7] = base[6] + s*c*c*c*c*c*c;
|
||||||
|
|
||||||
QList<quint64> bytes;
|
QList<quint64> bytes;
|
||||||
QList<int> separators;
|
QList<quint32> separators;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int count = bitvec.count();
|
int count = bitvec.count();
|
||||||
@ -133,22 +133,25 @@ QString JSC::decompress(Codeword const& bitvec){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int start = 0;
|
quint32 start = 0;
|
||||||
while(start < bytes.length()){
|
while(start < (quint32)bytes.length()){
|
||||||
int k = 0;
|
quint32 k = 0;
|
||||||
int j = 0;
|
quint32 j = 0;
|
||||||
|
|
||||||
while(start + k < bytes.length() && bytes[start + k] >= s){
|
while(start + k < (quint32)bytes.length() && bytes[start + k] >= s){
|
||||||
j = j*c + (bytes[start + k] - s);
|
j = j*c + (bytes[start + k] - s);
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
if(j >= JSC::size){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(start + k >= bytes.length()){
|
if(start + k >= (quint32)bytes.length()){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
j = j*s + bytes[start + k] + base[k];
|
j = j*s + bytes[start + k] + base[k];
|
||||||
|
|
||||||
if(j >= (int)JSC::size){
|
if(j >= JSC::size){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1852,6 +1852,9 @@ void MainWindow::initializeDummyData(){
|
|||||||
c.setCharFormat(f);
|
c.setCharFormat(f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// this causes a segfault!
|
||||||
|
processDecodedLine("223000 -15 -0.3 1681 B 6t++yk+aJbaE 6 \n");
|
||||||
|
|
||||||
ui->extFreeTextMsgEdit->setPlainText("HELLOBRAVE NEW WORLD");
|
ui->extFreeTextMsgEdit->setPlainText("HELLOBRAVE NEW WORLD");
|
||||||
ui->extFreeTextMsgEdit->setCharsSent(6);
|
ui->extFreeTextMsgEdit->setCharsSent(6);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user