bestswifter / BSBacktraceLogger

记录线程的调用栈
GNU General Public License v3.0
977 stars 216 forks source link

unsigned integer overflow #13

Open k373379320 opened 5 years ago

k373379320 commented 5 years ago

https://github.com/bestswifter/BSBacktraceLogger/blob/master/BSBacktraceLogger/BSBacktraceLogger.m#L318

untime error: unsigned integer overflow: 20274 - 21786 cannot be represented in type 'unsigned long'

for(uint32_t iSym = 0; iSym < symtabCmd->nsyms; iSym++) { // If n_value is 0, the symbol refers to an external object. if(symbolTable[iSym].n_value != 0) { uintptr_t symbolBase = symbolTable[iSym].n_value; uintptr_t currentDistance = addressWithSlide - symbolBase; if((addressWithSlide >= symbolBase) && (currentDistance <= bestDistance)) { bestMatch = symbolTable + iSym; bestDistance = currentDistance; } } }

k373379320 commented 5 years ago

https://github.com/plausiblelabs/plcrashreporter/commit/8e143316c26fe73bc9248c4c3d955e743cdbce59