In Line 110 based on length of passed by user args array, xcalloc allocates buffer for ffitype structures.
Later in for loop we see that each element from this array is first converted to int and later to ffitype structure.
Results of this conversions are stored in previous allocated array "arg_types".

Exploiting knowledge that in Line 113 NUM2INT for non Integer object will call "to_int" method we can create properly constructed object which will

implement this method and it's responsible will be to increase size of args array. Increased size of args array inside for loop just after space
allocation for argtypes will cause during next iteration heap overflow in Line 114 and later in Line 116 during storing another ffitype structures.