Hi, i have found two bugs into QoSQspecObject.cpp
*Your code:*
void QosQspecObject::analyze(unsigned char * buffer, unsigned int length) { unsigned int offset = 4; // <-- FIRST BUG
qspecHeader = new CommonQspecHeader(buffer + offset, 4); offset += 4;
while (true) { if (offset >= length) // <-- SECOND BUG break;
*The correct code is:
*void QosQspecObject::analyze(unsigned char * buffer, unsigned int length) { unsigned int offset = 0; // buffer already set to "common qspec header" memory block
qspecHeader = new CommonQspecHeader(buffer + offset, 4); offset += 4;
while (true) { if (offset >= (length * 4)) // offset is 8bit word, length is 32bit word break;
Please check if this code is correct
Ciao Massimo
Hi Massimo,
the first one is a bug, the second I don't think so.
at the end of the loop offset is incremented 4 times the length of the object
offset += paramheader.length() * 4; gesetzt.
and length = tail - buffer, so length and contain bytes and not words.
50 unsigned int GenericObject::getLength() 51 { 52 return tail - buffer; 53 } 54 55 void GenericObject::setBuffer(unsigned char * buffer, unsigned int length, bool readOnlyMemory) 56 { 57 mymemory = !readOnlyMemory; 58 this->buffer = buffer; 59 tail = buffer; 60 analyze(buffer, length); 61 } 62
Thanks for debugging!
Bernd
Massimo Vellucci wrote:
Hi, i have found two bugs into QoSQspecObject.cpp
*Your code:*
void QosQspecObject::analyze(unsigned char * buffer, unsigned int length) { unsigned int offset = 4; // <-- FIRST BUG
qspecHeader = new CommonQspecHeader(buffer + offset, 4); offset += 4; while (true) { if (offset >= length) // <-- SECOND BUG break;
*The correct code is:
*void QosQspecObject::analyze(unsigned char * buffer, unsigned int length) { unsigned int offset = 0; // buffer already set to "common qspec header" memory block
qspecHeader = new CommonQspecHeader(buffer + offset, 4); offset += 4; while (true) { if (offset >= (length * 4)) // offset is 8bit
word, length is 32bit word break;
Please check if this code is correct
Ciao Massimo
Nsis_Imp mailing list Nsis_Imp@informatik.uni-goettingen.de https://user.informatik.uni-goettingen.de/mailman/listinfo/nsis_imp
nsis_imp@informatik.uni-goettingen.de