[R-sig-DB] Insufficient PROTECT in RMySQL code
NISHIYAMA Tomoaki
tomo@k|n @end|ng |rom @t@||@k@n@z@w@-u@@c@jp
Tue Oct 9 11:21:12 CEST 2012
Hi,
We recently identified errors in RPostgreSQL that PROTECT is not
issued where needed. The behaviour reported at
http://code.google.com/p/rpostgresql/issues/detail?id=42
is similar in RMySQL.
The fix is seeking every C code returning a pointer to s_object or
its aliases (i.e., Mgr_Handle, Con_Handle, Res_Handle, Db_Handle),
and carefully ensure the structure returned is properly constructed in
PROTECTed block.
We do not have test for every places, but the following example
suggests that RMySQL probably has at least one similar error.
> library(RMySQL)
Loading required package: DBI
> con <- dbConnect('MySQL')
> rs <-dbSendQuery(con,'SELECT 1;')
> dbColumnInfo(rs)
name Sclass type len precision scale nullOK
1 1 integer FIELD_TYPE_LONGLONG 1 1 0 FALSE
> dbColumnInfo(rs)
name Sclass type len precision scale nullOK
1 1 integer FIELD_TYPE_LONGLONG 1 1 0 FALSE
> gctorture(TRUE)
> dbColumnInfo(rs)
name Sclass type len precision scale nullOK
1 1 integer FIELD_TYPE_LONGLONG 1 1 0 FALSE
> dbColumnInfo(rs)
Error in mysqlDescribeFields(res, ...) :
RS-DBI driver: (internal error in RS_DBI_SclassNames: input S types must be nonNULL)
Another pattern:
> library(RMySQL)
Loading required package: DBI
> gctorture(TRUE)
> con <-dbConnect('MySQL')
> con
<MySQLConnection:(19925,0)>
> rs <-dbSendQuery(con,'SELECT 1;')
> dbColumnInfo(rs)
Error: protect(): protection stack overflow
This was tested with RMySQL_0.9-3.
Best regards,
--
Tomoaki NISHIYAMA
Advanced Science Research Center,
Kanazawa University,
13-1 Takara-machi,
Kanazawa, 920-0934, Japan
[[alternative HTML version deleted]]
More information about the R-sig-DB
mailing list