martong added a comment. In D92307#2422468 <https://reviews.llvm.org/D92307#2422468>, @vsavchenko wrote:
> That's a good fix! > How did this happen though that max value of `off_t` was even used for `fd`. > Seems pretty odd! I used a semi-automated approach to create these summaries from cppcheck <https://github.com/danmar/cppcheck/blob/main/cfg/posix.cfg> : I translated the XML into C++ source code, but could not do the translation for ranges. E.g., `0:` was just simply copied and I had to manually modify the generated C++ code to have the proper range. And that's where I made the wrong index for the param (cppcheck starts from idx 1, here we start from idx 0). Here the 5th param has the `off_t` type, so I thought we have to get the max for `off_t`. ================ Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1738 Optional<QualType> Off64_tTy = lookupTy("off64_t"); - Optional<RangeInt> Off64_tMax = getMaxValue(Off_tTy); // void *mmap64(void *addr, size_t length, int prot, int flags, int fd, ---------------- steakhal wrote: > BTW this should have referred to `Off64_tTy` instead of `Off_tTy`. > Not a problem anymore :D Yep, copy pasta error again, my bad :( ================ Comment at: clang/test/Analysis/std-c-library-posix-crash.c:1 +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=core,apiModeling.StdCLibraryFunctions \ ---------------- I like this new test file. Probably we are going to extend this as we advance with the evaluation of these summaries on open-source projects. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92307/new/ https://reviews.llvm.org/D92307 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits