[PATCH] D116722: [clang] Verify ssp buffer size is a valid integer

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 7 10:19:01 PST 2022


compnerd added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3204
       if (StackProtectorLevel) {
-        CmdArgs.push_back("-stack-protector-buffer-size");
-        // FIXME: Verify the argument is a valid integer.
-        CmdArgs.push_back(Args.MakeArgString(Str.drop_front(16)));
+        auto BufferSize = Str.drop_front(16);
+        if (IsInteger(BufferSize)) {
----------------
I really am not a fan of the `16` here.  Why not just use `split` and split on `=`?  Or use [constexpr] `strlen`?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3209
+        } else
+          D.Diag(clang::diag::err_invalid_ssp_buffer_size);
       }
----------------
Please consistently use the braces (either applied to both or on neither).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116722/new/

https://reviews.llvm.org/D116722



More information about the cfe-commits mailing list