Skip to content

Conversation

@zeyi2
Copy link
Member

@zeyi2 zeyi2 commented Nov 13, 2025

This check is introduced in b284005, but the documentation seems missing from checkers.rst.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels Nov 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-static-analyzer-1

Author: mitchell (zeyi2)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/167822.diff

1 Files Affected:

  • (modified) clang/docs/analyzer/checkers.rst (+20-1)
diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst
index fd0b304cba0df..51ca5e112c6bd 100644
--- a/clang/docs/analyzer/checkers.rst
+++ b/clang/docs/analyzer/checkers.rst
@@ -198,7 +198,7 @@ as error. Specifically on x86/x86-64 target if the pointer address space is
 dereference is not defined as error. See `X86/X86-64 Language Extensions
 <https://clang.llvm.org/docs/LanguageExtensions.html#memory-references-to-specified-segments>`__
 for reference.
-	
+
 If the analyzer option ``suppress-dereferences-from-any-address-space`` is set
 to true (the default value), then this checker never reports dereference of
 pointers with a specified address space. If the option is set to false, then
@@ -1664,6 +1664,25 @@ Warn on uses of the 'bzero' function.
    bzero(ptr, n); // warn
  }
 
+.. _security-insecureAPI-decodeValueOfObjCType:
+
+security.insecureAPI.decodeValueOfObjCType (C)
+"""""""""""""""""""""""""""""""""""""""
+Warn on uses of the Objective-C method ``-decodeValueOfObjCType:at:``.
+
+.. code-block:: objc
+
+  void test(NSCoder *decoder) {
+    unsigned int x;
+    [decoder decodeValueOfObjCType:"I" at:&x]; // warn
+  }
+
+This diagnostic is emitted only on Apple platforms where the safer
+``-decodeValueOfObjCType:at:size:`` alternative is available
+(
+iOS 11+, macOS 10.13+, tvOS 11+, watchOS 4.0+
+).
+
 .. _security-insecureAPI-getpw:
 
 security.insecureAPI.getpw (C)

Copy link
Contributor

@NagyDonat NagyDonat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this missing documentation! The commit looks good to me if you handle one small formatting issue that I marked with an inline comment.

(By the way, note that these security.insecureAPI checkers are "out of place" in the analyzer. These were developed a long time ago and they are "grandfathered in" because they are used by the users, but freshly developed simple AST-based checks like this would belong to Clang-Tidy -- which is a more lightweight tool and is more accessible for the users. However, this doesn't detract from the value of this documentation patch -- documentation is equally valuable for all checkers that we provide.)

Co-authored-by: Donát Nagy <donat.nagy@ericsson.com>
@zeyi2
Copy link
Member Author

zeyi2 commented Nov 13, 2025

Thanks for reviewing! I've updated the formatting, everything should be good now :)

@zeyi2
Copy link
Member Author

zeyi2 commented Nov 17, 2025

@NagyDonat Hi, could you help merge this PR? Thanks!

@NagyDonat
Copy link
Contributor

Of course 😄

@NagyDonat NagyDonat merged commit c2ddaaa into llvm:main Nov 17, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:static analyzer clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants