salange/NPP2 — pull request #1 by JulianSchmid (2012-11-21 16:08:27+00:00)
Title: demo_src/basic_usage/train_net.cpp params array size changed

Fixed possible illegal memory acces in demo_src/basic_usage/train_net.cpp . NPP2::Net::setUpdateFunction always tries to copy MAX_PARAMS params, this can lead to an illegal memory access if an array with less elements then MAX_PARAMS is being copied.

Old:
```c++
...
Net net;
double param[3] = { // RPROP parameters
0.1, // delta 0
0.8, // delta max
0.0 // weight-decay
};

net.createLayers(4, &topology[0], numThreads); // create 4 "standard" layers
net.setUpdateFunc(0, ¶m[0]); // use RPROP
...
```

```c++
void Net::setUpdateFunc(int typ, FTYPE *params)
{
for (int j=0; j < MAX_PARAMS; j++) {
updateParams[j] = params[j]; //illegal access
}
...
}
```

changed to:
```c++
...
Net net;
double param[MAX_PARAMS]; // RPROP parameters
param[0] = 0.1; // delta 0
param[1] = 0.8; // delta max
param[2] = 0.0; // weight-decay

net.createLayers(4, &topology[0], numThreads); // create 4 "standard" layers
net.setUpdateFunc(0, ¶m[0]); // use RPROP
...
```