george.karpenkov requested changes to this revision. george.karpenkov added inline comments. This revision now requires changes to proceed.
================ Comment at: lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp:164 + // - sizeof(dst) + if (Append && isSizeof(LenArg, DstArg)) + return true; ---------------- george.karpenkov wrote: > george.karpenkov wrote: > > I am confused on what is happening in this branch and why is it bad. Could > > we add a commend? > Sorry I'm still confused about this branch: could you clarify? Ah, OK, I see it needs one more byte due to null-termination. ================ Comment at: lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp:199 uint64_t BufferLen = C.getTypeSize(Buffer) / 8; - if ((BufferLen - DstOff) < ILRawVal) - return true; + auto RemainingBufferLen = BufferLen - DstOff; + if (Append) { ---------------- Probably better expressed as: ``` if (Append) RemainingBufferLen -= 1; ``` Then you don't need branching. https://reviews.llvm.org/D49722 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits