Commit cdc2dc2c by Konstantin Käfer

throw error when using invalid indexes

parent 426a2de1
...@@ -382,7 +382,8 @@ Handle<Value> Statement::Bind(const Arguments& args) { ...@@ -382,7 +382,8 @@ Handle<Value> Statement::Bind(const Arguments& args) {
pair->key_type = KEY_INT; pair->key_type = KEY_INT;
int *index = (int *) malloc(sizeof(int)); int *index = (int *) malloc(sizeof(int));
*index = args[0]->Int32Value(); *index = args[0]->Int32Value();
if (*index < 1) return ThrowException(Exception::TypeError(
String::New("Parameter position index start with 1.")));
// don't forget to `free` this // don't forget to `free` this
pair->key = index; pair->key = index;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment