Merge pull request #430 from theopolis/fix-biging

Check tables row vector size before access
This commit is contained in:
Teddy Reed 2014-11-14 15:25:39 -08:00
commit 0cb30d8ccb

View File

@ -72,6 +72,7 @@ int {{table_name_cc}}Column(
{% for col in schema %}\
// {{ col.name }}
case {{ loop.index0 }}:
if (pVtab->pContent->xCol_{{col.name}}.size() > pCur->row) {
{% if col.type.affinity == "TEXT" %}\
sqlite3_result_text(
ctx,
@ -92,6 +93,7 @@ int {{table_name_cc}}Column(
({{col.type.type}})pVtab->pContent->xCol_{{col.name}}[pCur->row]
);
{% endif %}\
}
break;
{% endfor %}\
}
@ -134,7 +136,7 @@ int {{table_name_cc}}Filter(
pVtab->pContent->xCol_{{col.name}}.push_back(-1);
}
{% endif %}\
{% if col.type == "BIGINT" %}\
{% if col.type.affinity == "BIGINT" %}\
try {
pVtab->pContent->xCol_{{col.name}}\
.push_back(boost::lexical_cast<{{col.type.type}}>(row["{{col.name}}"]));