<commit_before>#! /usr/bin/tcc -run

#include <string.h>  // memcpy
#include <stdio.h>   // printf
#include <stdlib.h>  // malloc
#include <assert.h>  // assert

#define textbound   texndx = (int) (text + iy);          \
                    assert(textmin <= texndx);           \
                    assert(textmax >= texndx);           

typedef struct {ssize_t size; char *row; int count;} slot;

    slot line; 
    slot *text;

int main(void)
{
 int leng = 10; 
 text = malloc(leng*sizeof(slot)); 

 int textmax = (int) (text + leng - 1);
 int textmin = (int) (text + 0);

 line.row = NULL;
 line.size = 0;

 int iy; for(iy = 0; iy < leng+1; iy++)     //deliberate iy overrun
   {
     printf("%d  text = %p\n",iy,text+iy);
     int texndx; textbound; 
     text[iy] = line;
   } 

 printf("test run ending\n");
 return 0;
}<commit_msg>Demonstrate t & s limit checking<commit_after>#! /usr/bin/tcc -run

//demonstrate index out of bounds error 
//flagged by statement number

//set smax or tmax when malloc is called

#include <string.h>  // memcpy
#include <stdio.h>   // printf
#include <stdlib.h>  // malloc
#include <assert.h>  // assert

#define tbound   assert(t >= 0); assert(t <= tmax);
#define sbound   assert(s >= 0); assert(s <= smax);          

typedef struct {ssize_t size; char *row; int count;} slot;

    slot line; slot *text;
    int smax, tmax;

int main(void)
{
 int s,t,smax,tmax;
 int leng = 10; 
 text = malloc(leng*sizeof(slot)); tmax = leng - 1;

 line.row = NULL;
 line.size = 0;

// insert deliberate iy overrun in next line

 int iy; for(iy = 0; iy < leng +7; iy++)   
   {
     t = iy; tbound; text[iy] = line;
   } 

 line.row = "sing that story";
 line.size = strlen(line.row); smax = line.size -1;

// insert deliberate s overrun in next line

 for(s = 0; s < line.size + 5; s++)
   {
     sbound; printf("%c",line.row[s]);
   }
 printf("\n");

// put deliberate t out of bounds in next line

   t=-15; tbound; text[t] = line; 
   printf("%s\n",text[t].row);

 printf("test run ending\n");

 return 0;
}
{'fraction_non_alphanumeric': 0.16225490196078432, 'fraction_numerical': 0.010784313725490196, 'mean_word_length': 2.506872852233677, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1405427', 'n_tokens_mistral': 805, 'n_tokens_neox': 739, 'n_words': 228}