1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
5 <title>Alpha Checks</title>
6 <link type="text/css" rel="stylesheet" href="menu.css">
7 <link type="text/css" rel="stylesheet" href="content.css">
8 <script type="text/javascript" src="scripts/menu.js"></script>
9 <script type="text/javascript" src="scripts/expandcollapse.js"></script>
10 <style type="text/css">
11 tr:first-child { width:20%; }
14 <body onload="initExpandCollapse()">
17 <!--#include virtual="menu.html.incl"-->
20 <h1>Alpha Checkers</h1>
21 Experimental checkers in addition to the <a href = "available_checks.html">
22 Default Checkers</a>. These are checkers with known issues or limitations that
23 keep them from being on by default. They are likely to have false positives.
24 Bug reports are welcome but will likely not be investigated for some time.
27 <li><a href="#core_alpha_checkers">Core Alpha Checkers</a></li>
28 <li><a href="#cplusplus_alpha_checkers">C++ Alpha Checkers</a></li>
29 <li><a href="#valist_alpha_checkers">Variable Argument Alpha Checkers</a></li>
30 <li><a href="#deadcode_alpha_checkers">Dead Code Alpha Checkers</a></li>
31 <li><a href="#osx_alpha_checkers">OS X Alpha Checkers</a></li>
32 <li><a href="#security_alpha_checkers">Security Alpha Checkers</a></li>
33 <li><a href="#unix_alpha_checkers">Unix Alpha Checkers</a></li>
36 <!-- ============================= core alpha ============================= -->
37 <h3 id="core_alpha_checkers">Core Alpha Checkers</h3>
38 <table class="checkers">
39 <colgroup><col class="namedescr"><col class="example"></colgroup>
40 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
43 <tr><td><div class="namedescr expandable"><span class="name">
44 alpha.core.BoolAssignment</span><span class="lang">
45 (ObjC)</span><div class="descr">
46 Warn about assigning non-{0,1} values to boolean variables.</div></div></td>
47 <td><div class="exampleContainer expandable">
48 <div class="example"><pre>
52 </pre></div></div></td></tr>
55 <tr><td><div class="namedescr expandable"><span class="name">
56 alpha.core.CastSize</span><span class="lang">
57 (C)</span><div class="descr">
58 Check when casting a malloc'ed type T, whether the size is a multiple of the
59 size of T (Works only with <span class="name">unix.Malloc</span>
60 or <span class="name">alpha.unix.MallocWithAnnotations</span>
61 checks enabled).</div></div></td>
62 <td><div class="exampleContainer expandable">
63 <div class="example"><pre>
65 int *x = (int *)malloc(11); // warn
67 </pre></div></div></td></tr>
70 <tr><td><div class="namedescr expandable"><span class="name">
71 alpha.core.CastToStruct</span><span class="lang">
72 (C, C++)</span><div class="descr">
73 Check for cast from non-struct pointer to struct pointer.</div></div></td>
74 <td><div class="exampleContainer expandable">
75 <div class="example"><pre>
80 struct s *ps = (struct s *) p; // warn
82 </pre></div><div class="separator"></div>
83 <div class="example"><pre>
88 c *pc = (c *) p; // warn
90 </pre></div></div></td></tr>
93 <tr><td><div class="namedescr expandable"><span class="name">
94 alpha.core.FixedAddr</span><span class="lang">
95 (C)</span><div class="descr">
96 Check for assignment of a fixed address to a pointer.</div></div></td>
97 <td><div class="exampleContainer expandable">
98 <div class="example"><pre>
101 p = (int *) 0x10000; // warn
103 </pre></div></div></td></tr>
106 <tr><td><div class="namedescr expandable"><span class="name">
107 alpha.core.IdenticalExpr</span><span class="lang">
108 (C, C++)</span><div class="descr">
109 Warn about suspicious uses of identical expressions.</div></div></td>
110 <td><div class="exampleContainer expandable">
111 <div class="example"><pre>
115 int b = a | 4 | a; // warn: identical expr on both sides
117 </pre></div><div class="separator"></div>
118 <div class="example"><pre>
124 if (f()) { // warn: true and false branches are identical
134 </pre></div></div></td></tr>
137 <tr><td><div class="namedescr expandable"><span class="name">
138 alpha.core.PointerArithm</span><span class="lang">
139 (C)</span><div class="descr">
140 Check for pointer arithmetic on locations other than array
141 elements.</div></div></td>
142 <td><div class="exampleContainer expandable">
143 <div class="example"><pre>
147 p = &x + 1; // warn
149 </pre></div></div></td></tr>
152 <tr><td><div class="namedescr expandable"><span class="name">
153 alpha.core.PointerSub</span><span class="lang">
154 (C)</span><div class="descr">
155 Check for pointer subtractions on two pointers pointing to different memory
156 chunks.</div></div></td>
157 <td><div class="exampleContainer expandable">
158 <div class="example"><pre>
161 int d = &y - &x; // warn
163 </pre></div></div></td></tr>
166 <tr><td><div class="namedescr expandable"><span class="name">
167 alpha.core.SizeofPtr</span><span class="lang">
168 (C)</span><div class="descr">
169 Warn about unintended use of <code>sizeof()</code> on pointer
170 expressions.</div></div></td>
171 <td><div class="exampleContainer expandable">
172 <div class="example"><pre>
175 int test(struct s *p) {
177 // warn: sizeof(ptr) can produce an unexpected result
179 </pre></div></div></td></tr>
183 <!-- =========================== cplusplus alpha =========================== -->
184 <h3 id="cplusplus_alpha_checkers">C++ Alpha Checkers</h3>
185 <table class="checkers">
186 <colgroup><col class="namedescr"><col class="example"></colgroup>
187 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
190 <tr><td><div class="namedescr expandable"><span class="name">
191 alpha.cplusplus.NewDeleteLeaks</span><span class="lang">
192 (C++)</span><div class="descr">
193 Check for memory leaks. Traces memory managed by <code>new</code>/<code>
194 delete</code>.</div></div></td>
195 <td><div class="exampleContainer expandable">
196 <div class="example"><pre>
200 </pre></div></div></td></tr>
203 <tr><td><div class="namedescr expandable"><span class="name">
204 alpha.cplusplus.VirtualCall</span><span class="lang">
205 (C++)</span><div class="descr">
206 Check virtual member function calls during construction or
207 destruction.</div></div></td>
208 <td><div class="exampleContainer expandable">
209 <div class="example"><pre>
217 </pre></div><div class="separator"></div>
218 <div class="example"><pre>
222 this->f(); // warn
226 </pre></div></div></td></tr>
232 <!-- =============================== va_list =============================== -->
233 <h3 id="valist_alpha_checkers">Variable Argument Alpha Checkers</h3>
234 <table class="checkers">
235 <colgroup><col class="namedescr"><col class="example"></colgroup>
236 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
239 <tr><td><div class="namedescr expandable"><span class="name">
240 alpha.valist.CopyToSelf</span><span class="lang">
241 (C)</span><div class="descr">
242 Calls to the <code>va_copy</code> macro should not copy onto itself.</div></div></td>
243 <td><div class="exampleContainer expandable">
244 <div class="example"><pre>
245 #include <stdarg.h>
247 void test(int x, ...) {
250 va_copy(args, args); // warn
253 </pre></div></div></td></tr>
255 <tr><td><div class="namedescr expandable"><span class="name">
256 alpha.valist.Uninitialized</span><span class="lang">
257 (C)</span><div class="descr">
258 Calls to the <code>va_arg</code>, <code>va_copy</code>, or
259 <code>va_end</code> macro must happen after calling <code>va_start</code> and
260 before calling <code>va_end</code>.</div></div></td>
261 <td><div class="exampleContainer expandable">
262 <div class="example"><pre>
263 #include <stdarg.h>
265 void test(int x, ...) {
267 int y = va_arg(args, int); // warn
270 <div class="example"><pre>
271 #include <stdarg.h>
273 void test(int x, ...) {
277 int z = va_arg(args, int); // warn
279 </pre></div></div></td></tr>
281 <tr><td><div class="namedescr expandable"><span class="name">
282 alpha.valist.Unterminated</span><span class="lang">
283 (C)</span><div class="descr">
284 Every <code>va_start</code> must be matched by a <code>va_end</code>. A va_list
285 can only be ended once.</div></div></td>
286 <td><div class="exampleContainer expandable">
287 <div class="example"><pre>
288 #include <stdarg.h>
290 void test(int x, ...) {
293 int y = x + va_arg(args, int);
294 } // warn: missing va_end
295 </pre></div></div></td></tr>
299 <!-- =========================== dead code alpha =========================== -->
300 <h3 id="deadcode_alpha_checkers">Dead Code Alpha Checkers</h3>
301 <table class="checkers">
302 <colgroup><col class="namedescr"><col class="example"></colgroup>
303 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
306 <tr><td><div class="namedescr expandable"><span class="name">
307 alpha.deadcode.UnreachableCode</span><span class="lang">
308 (C, C++, ObjC)</span><div class="descr">
309 Check unreachable code.</div></div></td>
310 <td><div class="exampleContainer expandable">
311 <div class="example"><pre>
318 </pre></div><div class="separator"></div>
319 <div class="example"><pre>
330 </pre></div><div class="separator"></div>
331 <div class="example"><pre>
337 </pre></div></div></td></tr>
340 <!-- ============================== OS X alpha ============================== -->
341 <h3 id="osx_alpha_checkers">OS X Alpha Checkers</h3>
342 <table class="checkers">
343 <colgroup><col class="namedescr"><col class="example"></colgroup>
344 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
347 <tr><td><div class="namedescr expandable"><span class="name">
348 alpha.osx.cocoa.Dealloc</span><span class="lang">
349 (ObjC)</span><div class="descr">
350 Warn about Objective-C classes that lack a correct implementation
351 of <code>-dealloc</code>.
353 <td><div class="exampleContainer expandable">
354 <div class="example"><pre>
355 @interface MyObject : NSObject {
360 @implementation MyObject // warn: lacks 'dealloc'
362 </pre></div><div class="separator"></div>
363 <div class="example"><pre>
364 @interface MyObject : NSObject {}
365 @property(assign) id myproperty;
368 @implementation MyObject // warn: does not send 'dealloc' to super
373 </pre></div><div class="separator"></div>
374 <div class="example"><pre>
375 @interface MyObject : NSObject {
378 @property(retain) id myproperty;
381 @implementation MyObject
382 @synthesize myproperty = _myproperty;
383 // warn: var was retained but wasn't released
388 </pre></div><div class="separator"></div>
389 <div class="example"><pre>
390 @interface MyObject : NSObject {
393 @property(assign) id myproperty;
396 @implementation MyObject
397 @synthesize myproperty = _myproperty;
398 // warn: var wasn't retained but was released
400 [_myproperty release];
404 </pre></div></div></td></tr>
407 <tr><td><div class="namedescr expandable"><span class="name">
408 alpha.osx.cocoa.DirectIvarAssignment</span><span class="lang">
409 (ObjC)</span><div class="descr">
410 Check that Objective C properties follow the following rule: the property
411 should be set with the setter, not though a direct assignment.</div></div></td>
412 <td><div class="exampleContainer expandable">
413 <div class="example"><pre>
414 @interface MyClass : NSObject {}
415 @property (readonly) id A;
419 @implementation MyClass
424 </pre></div></div></td></tr>
427 <tr><td><div class="namedescr expandable"><span class="name">
428 alpha.osx.cocoa.DirectIvarAssignmentForAnnotatedFunctions</span><span class="lang">
429 (ObjC)</span><div class="descr">
430 Check for direct assignments to instance variables in the methods annotated
431 with <code>objc_no_direct_instance_variable_assignment</code>.</div></div></td>
432 <td><div class="exampleContainer expandable">
433 <div class="example"><pre>
434 @interface MyClass : NSObject {}
435 @property (readonly) id A;
436 - (void) fAnnotated __attribute__((
437 annotate("objc_no_direct_instance_variable_assignment")));
438 - (void) fNotAnnotated;
441 @implementation MyClass
442 - (void) fAnnotated {
445 - (void) fNotAnnotated {
449 </pre></div></div></td></tr>
452 <tr><td><div class="namedescr expandable"><span class="name">
453 alpha.osx.cocoa.InstanceVariableInvalidation</span><span class="lang">
454 (ObjC)</span><div class="descr">
455 Check that the invalidatable instance variables are invalidated in the methods
456 annotated with <code>objc_instance_variable_invalidator</code>.</div></div></td>
457 <td><div class="exampleContainer expandable">
458 <div class="example"><pre>
459 @protocol Invalidation <NSObject>
461 __attribute__((annotate("objc_instance_variable_invalidator")));
464 @interface InvalidationImpObj : NSObject <Invalidation>
467 @interface SubclassInvalidationImpObj : InvalidationImpObj {
468 InvalidationImpObj *var;
473 @implementation SubclassInvalidationImpObj
474 - (void) invalidate {}
476 // warn: var needs to be invalidated or set to nil
477 </pre></div></div></td></tr>
480 <tr><td><div class="namedescr expandable"><span class="name">
481 alpha.osx.cocoa.MissingInvalidationMethod</span><span class="lang">
482 (ObjC)</span><div class="descr">
483 Check that the invalidation methods are present in classes that contain
484 invalidatable instance variables.</div></div></td>
485 <td><div class="exampleContainer expandable">
486 <div class="example"><pre>
487 @protocol Invalidation <NSObject>
489 __attribute__((annotate("objc_instance_variable_invalidator")));
492 @interface NeedInvalidation : NSObject <Invalidation>
495 @interface MissingInvalidationMethodDecl : NSObject {
496 NeedInvalidation *Var; // warn
500 @implementation MissingInvalidationMethodDecl
502 </pre></div></div></td></tr>
506 <!-- =========================== security alpha =========================== -->
507 <h3 id="security_alpha_checkers">Security Alpha Checkers</h3>
508 <table class="checkers">
509 <colgroup><col class="namedescr"><col class="example"></colgroup>
510 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
513 <tr><td><div class="namedescr expandable"><span class="name">
514 alpha.security.ArrayBound</span><span class="lang">
515 (C)</span><div class="descr">
516 Warn about buffer overflows (older checker).</div></div></td>
517 <td><div class="exampleContainer expandable">
518 <div class="example"><pre>
521 char c = s[1]; // warn
523 </pre></div><div class="separator"></div>
524 <div class="example"><pre>
530 struct seven_words a, *p;
536 </pre></div><div class="separator"></div>
537 <div class="example"><pre>
538 // note: requires unix.Malloc or
539 // alpha.unix.MallocWithAnnotations checks enabled.
544 </pre></div><div class="separator"></div>
545 <div class="example"><pre>
551 </pre></div></div></td></tr>
554 <tr><td><div class="namedescr expandable"><span class="name">
555 alpha.security.ArrayBoundV2</span><span class="lang">
556 (C)</span><div class="descr">
557 Warn about buffer overflows (newer checker).</div></div></td>
558 <td><div class="exampleContainer expandable">
559 <div class="example"><pre>
562 char c = s[1]; // warn
564 </pre></div><div class="separator"></div>
565 <div class="example"><pre>
572 </pre></div><div class="separator"></div>
573 <div class="example"><pre>
574 // note: compiler has internal check for this.
575 // Use -Wno-array-bounds to suppress compiler warning.
578 buf[0][-1] = 1; // warn
580 </pre></div><div class="separator"></div>
581 <div class="example"><pre>
582 // note: requires alpha.security.taint check turned on.
586 char c = s[x]; // warn: index is tainted
588 </pre></div></div></td></tr>
591 <tr><td><div class="namedescr expandable"><span class="name">
592 alpha.security.MallocOverflow</span><span class="lang">
593 (C)</span><div class="descr">
594 Check for overflows in the arguments to <code>malloc()</code>.</div></div></td>
595 <td><div class="exampleContainer expandable">
596 <div class="example"><pre>
598 void *p = malloc(n * sizeof(int)); // warn
600 </pre></div></div></td></tr>
603 <tr><td><div class="namedescr expandable"><span class="name">
604 alpha.security.ReturnPtrRange</span><span class="lang">
605 (C)</span><div class="descr">
606 Check for an out-of-bound pointer being returned to callers.</div></div></td>
607 <td><div class="exampleContainer expandable">
608 <div class="example"><pre>
615 </pre></div><div class="separator"></div>
616 <div class="example"><pre>
619 return x; // warn: undefined or garbage returned
621 </pre></div></div></td></tr>
624 <tr><td><div class="namedescr expandable"><span class="name">
625 alpha.security.taint.TaintPropagation</span><span class="lang">
626 (C)</span><div class="descr">
627 Generate taint information used by other checkers.</div></div></td>
628 <td><div class="exampleContainer expandable">
629 <div class="example"><pre>
631 char x = getchar(); // 'x' marked as tainted
632 system(&x); // warn: untrusted data is passed to a system call
634 </pre></div><div class="separator"></div>
635 <div class="example"><pre>
636 // note: compiler internally checks if the second param to
637 // sprintf is a string literal or not.
638 // Use -Wno-format-security to suppress compiler warning.
641 fscanf(stdin, "%s", s); // 's' marked as tainted
643 sprintf(buf, s); // warn: untrusted data as a format string
645 </pre></div><div class="separator"></div>
646 <div class="example"><pre>
649 scanf("%zd", &ts); // 'ts' marked as tainted
650 int *p = (int *)malloc(ts * sizeof(int));
651 // warn: untrusted data as bufer size
653 </pre></div></div></td></tr>
657 <!-- ============================= unix alpha ============================= -->
658 <h3 id="unix_alpha_checkers">Unix Alpha Checkers</h3>
659 <table class="checkers">
660 <colgroup><col class="namedescr"><col class="example"></colgroup>
661 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
664 <tr><td><div class="namedescr expandable"><span class="name">
665 alpha.unix.Chroot</span><span class="lang">
666 (C)</span><div class="descr">
667 Check improper use of <code>chroot</code>.</div></div></td>
668 <td><div class="exampleContainer expandable">
669 <div class="example"><pre>
673 chroot("/usr/local");
674 f(); // warn: no call of chdir("/") immediately after chroot
676 </pre></div></div></td></tr>
679 <tr><td><div class="namedescr expandable"><span class="name">
680 alpha.unix.MallocWithAnnotations</span><span class="lang">
681 (C)</span><div class="descr">
682 Check for memory leaks, double free, and use-after-free problems. Assumes that
683 all user-defined functions which might free a pointer are
684 annotated.</div></div></td>
685 <td><div class="exampleContainer expandable">
686 <div class="example"><pre>
687 void __attribute((ownership_returns(malloc))) *my_malloc(size_t);
690 int *p = my_malloc(1);
691 } // warn: potential leak
692 </pre></div><div class="separator"></div>
693 <div class="example"><pre>
694 void __attribute((ownership_returns(malloc))) *my_malloc(size_t);
695 void __attribute((ownership_takes(malloc, 1))) my_free(void *);
698 int *p = my_malloc(1);
700 my_free(p); // warn: attempt to free released
702 </pre></div><div class="separator"></div>
703 <div class="example"><pre>
704 void __attribute((ownership_returns(malloc))) *my_malloc(size_t);
705 void __attribute((ownership_holds(malloc, 1))) my_hold(void *);
708 int *p = my_malloc(1);
710 free(p); // warn: attempt to free non-owned memory
712 </pre></div><div class="separator"></div>
713 <div class="example"><pre>
714 void __attribute((ownership_takes(malloc, 1))) my_free(void *);
719 *p = 1; // warn: use after free
721 </pre></div></div></td></tr>
724 <tr><td><div class="namedescr expandable"><span class="name">
725 alpha.unix.PthreadLock</span><span class="lang">
726 (C)</span><div class="descr">
727 Simple lock -> unlock checker; applies to:<div class=functions>
728 pthread_mutex_lock<br>
729 pthread_rwlock_rdlock<br>
730 pthread_rwlock_wrlock<br>
732 lck_rw_lock_exclusive<br>
733 lck_rw_lock_shared<br>
734 pthread_mutex_trylock<br>
735 pthread_rwlock_tryrdlock<br>
736 pthread_rwlock_tryrwlock<br>
738 lck_rw_try_lock_exclusive<br>
739 lck_rw_try_lock_shared<br>
740 pthread_mutex_unlock<br>
741 pthread_rwlock_unlock<br>
743 lck_rw_done</div></div></div></td>
744 <td><div class="exampleContainer expandable">
745 <div class="example"><pre>
749 pthread_mutex_lock(&mtx);
750 pthread_mutex_lock(&mtx);
751 // warn: this lock has already been acquired
753 </pre></div><div class="separator"></div>
754 <div class="example"><pre>
755 lck_mtx_t lck1, lck2;
760 lck_mtx_unlock(&lck1);
761 // warn: this was not the most recently acquired lock
763 </pre></div><div class="separator"></div>
764 <div class="example"><pre>
765 lck_mtx_t lck1, lck2;
768 if (lck_mtx_try_lock(&lck1) == 0)
772 lck_mtx_unlock(&lck1);
773 // warn: this was not the most recently acquired lock
775 </pre></div></div></td></tr>
778 <tr><td><div class="namedescr expandable"><span class="name">
779 alpha.unix.SimpleStream</span><span class="lang">
780 (C)</span><div class="descr">
781 Check for misuses of stream APIs:<div class=functions>
783 fclose</div>(demo checker, the subject of the demo
784 (<a href="http://llvm.org/devmtg/2012-11/Zaks-Rose-Checker24Hours.pdf">Slides</a>
785 ,<a href="http://llvm.org/devmtg/2012-11/videos/Zaks-Rose-Checker24Hours.mp4">Video</a>)
786 by Anna Zaks and Jordan Rose presented at the <a href="http://llvm.org/devmtg/2012-11/">
787 2012 LLVM Developers' Meeting).</a></div></div></td>
788 <td><div class="exampleContainer expandable">
789 <div class="example"><pre>
791 FILE *F = fopen("myfile.txt", "w");
792 } // warn: opened file is never closed
793 </pre></div><div class="separator"></div>
794 <div class="example"><pre>
796 FILE *F = fopen("myfile.txt", "w");
801 fclose(F); // warn: closing a previously closed file stream
803 </pre></div></div></td></tr>
806 <tr><td><div class="namedescr expandable"><span class="name">
807 alpha.unix.Stream</span><span class="lang">
808 (C)</span><div class="descr">
809 Check stream handling functions:<div class=functions>fopen<br>
822 fileno</div></div></div></td>
823 <td><div class="exampleContainer expandable">
824 <div class="example"><pre>
826 FILE *p = fopen("foo", "r");
827 } // warn: opened file is never closed
828 </pre></div><div class="separator"></div>
829 <div class="example"><pre>
831 FILE *p = fopen("foo", "r");
832 fseek(p, 1, SEEK_SET); // warn: stream pointer might be NULL
835 </pre></div><div class="separator"></div>
836 <div class="example"><pre>
838 FILE *p = fopen("foo", "r");
842 // warn: third arg should be SEEK_SET, SEEK_END, or SEEK_CUR
846 </pre></div><div class="separator"></div>
847 <div class="example"><pre>
849 FILE *p = fopen("foo", "r");
851 fclose(p); // warn: already closed
853 </pre></div><div class="separator"></div>
854 <div class="example"><pre>
857 ftell(p); // warn: stream pointer might be NULL
860 </pre></div></div></td></tr>
863 <tr><td><div class="namedescr expandable"><span class="name">
864 alpha.unix.cstring.BufferOverlap</span><span class="lang">
865 (C)</span><div class="descr">
866 Checks for overlap in two buffer arguments; applies to:<div class=functions>
868 mempcpy</div></div></div></td>
869 <td><div class="exampleContainer expandable">
870 <div class="example"><pre>
873 memcpy(a + 2, a + 1, 8); // warn
875 </pre></div></div></td></tr>
878 <tr><td><div class="namedescr expandable"><span class="name">
879 alpha.unix.cstring.NotNullTerminated</span><span class="lang">
880 (C)</span><div class="descr">
881 Check for arguments which are not null-terminated strings; applies
882 to:<div class=functions>
888 strncat</div></div></div></td>
889 <td><div class="exampleContainer expandable">
890 <div class="example"><pre>
892 int y = strlen((char *)&test); // warn
894 </pre></div></div></td></tr>
897 <tr><td><div class="namedescr expandable"><span class="name">
898 alpha.unix.cstring.OutOfBounds</span><span class="lang">
899 (C)</span><div class="descr">
900 Check for out-of-bounds access in string functions; applies
901 to:<div class=functions>
903 strncat</div></div></div></td>
904 <td><div class="exampleContainer expandable">
905 <div class="example"><pre>
909 strncpy(x, y, 5); // warn
911 </pre></div></div></td></tr>
914 <tr><td><div class="namedescr expandable"><span class="name">
915 alpha.unix.cstring.BlockInCriticalSection</span><span class="lang">
916 (C)</span><div class="descr">
917 Check for calls to blocking functions inside a critical section; applies
918 to:<div class=functions>
925 pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock<br>
926 mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlock<br>
927 </div></div></div></td>
928 <td><div class="exampleContainer expandable">
929 <div class="example"><pre>
930 void testBlockInCriticalSection() {
936 </pre></div></div></td></tr>
940 </div> <!-- content -->