1 struct field {                                                                                                               
   2     int b[8];                                                                                                                
   3 };                                                                                                                           
   4                                                                                                                              
   5 struct buffer {                                                                                                              
   6     struct field a;                                                                                                          
   7     int x;                                                                                                                   
   8 };                                                                                                                           
   9                                                                                                                              
  10 int main(int argc, char* argv[])                                                                                             
  11 {                                                                                                                            
  12     struct buffer b1;                                                                                                        
  13     int i;                                                                                                                   
  14                                                                                                                              
  15     b1.a.b[10] = 1;                                                                                                          
  16                                                                                                                              
  17     return 42;                                                                                                               
  18 }                                                                                                                            
  19                                                                                                                           
  20 /*
  21  * check-name: Check array overflow
  22  * check-command: smatch sm_overflow.c
  23  *
  24  * check-output-start
  25 sm_overflow.c:15 main() error: buffer overflow 'b1.a.b' 8 <= 10
  26  * check-output-end
  27  */