Some memory leaks and out of bounds array access fixed (#4498)
This commit is contained in:
committed by
Bertrand Songis
parent
1910af51b6
commit
7081f924de
@@ -678,45 +678,44 @@ void RlcFile::nextRlcWriteStep()
|
||||
return;
|
||||
}
|
||||
|
||||
bool run0 = (m_rlc_buf[0] == 0);
|
||||
if (m_rlc_len>0) {
|
||||
|
||||
if (m_rlc_len==0) goto close;
|
||||
bool run0 = (m_rlc_buf[0] == 0);
|
||||
|
||||
for (i=1; 1; i++) { // !! laeuft ein byte zu weit !!
|
||||
bool cur0 = m_rlc_buf[i] == 0;
|
||||
if (cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0x0f) || i==m_rlc_len) {
|
||||
if (run0) {
|
||||
assert(cnt0==0);
|
||||
if (cnt<8 && i!=m_rlc_len)
|
||||
cnt0 = cnt; //aufbew fuer spaeter
|
||||
for (i=1; 1; i++) { // !! laeuft ein byte zu weit !!
|
||||
bool cur0 = (i<m_rlc_len) ? (m_rlc_buf[i] == 0) : false;
|
||||
if (cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0x0f) || i==m_rlc_len) {
|
||||
if (run0) {
|
||||
assert(cnt0==0);
|
||||
if (cnt<8 && i!=m_rlc_len)
|
||||
cnt0 = cnt; //aufbew fuer spaeter
|
||||
else {
|
||||
m_rlc_buf+=cnt;
|
||||
m_rlc_len-=cnt;
|
||||
write1(cnt|0x40);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_rlc_buf+=cnt;
|
||||
m_rlc_len-=cnt;
|
||||
write1(cnt|0x40);
|
||||
m_rlc_buf+=cnt0;
|
||||
m_rlc_len-=cnt0+cnt;
|
||||
m_cur_rlc_len=cnt;
|
||||
if(cnt0){
|
||||
write1(0x80 | (cnt0<<4) | cnt);
|
||||
}
|
||||
else{
|
||||
write1(cnt);
|
||||
}
|
||||
return;
|
||||
}
|
||||
cnt=0;
|
||||
if (i==m_rlc_len) break;
|
||||
run0 = cur0;
|
||||
}
|
||||
else {
|
||||
m_rlc_buf+=cnt0;
|
||||
m_rlc_len-=cnt0+cnt;
|
||||
m_cur_rlc_len=cnt;
|
||||
if(cnt0){
|
||||
write1(0x80 | (cnt0<<4) | cnt);
|
||||
}
|
||||
else{
|
||||
write1(cnt);
|
||||
}
|
||||
return;
|
||||
}
|
||||
cnt=0;
|
||||
if (i==m_rlc_len) break;
|
||||
run0 = cur0;
|
||||
cnt++;
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
|
||||
close:
|
||||
|
||||
switch(m_write_step) {
|
||||
case WRITE_START_STEP: {
|
||||
blkid_t fri = 0;
|
||||
|
||||
Reference in New Issue
Block a user