Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fann_io: fix integer overflows in the layer_size parser
If layer_size is zero in the first layer, then ann->num_input will be 4294967295 (-1 cast to unsigned). This easily overflows the neuron buffer on the first fann_run() call, crashing the process. If layer_size is too large, ann->total_neurons will eventually overflow, which will allocate less neurons than needed. This, too, will eventually crash the process when those unallocated neurons are accessed.
- Loading branch information