#32204 [NEW]: sqlite_udf_encode_binary fails to escape some chunks
| From: | php at lachoseinteractive dot net | Date: | Sun, 06 Mar 2005 11:21:04 +0000 |
| Subject: | #32204 [NEW]: sqlite_udf_encode_binary fails to escape some chunks | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-74889@lists.php.net to get a copy of this message | ||
From: php at lachoseinteractive dot net
Operating system: Mac OS X 10.3
PHP version: 5.0.3
PHP Bug Type: SQLite related
Bug description: sqlite_udf_encode_binary fails to escape some chunks
Description:
------------
While I've used successfully sqlite_udf_encode_binary to
save hundreds of Mo of images in sqlite databases, I've
had a weird error on a .bmp file.
It looks like a quote character is not escaped.
I've reduced the chunk to its minimum and converted it
to base64.
The code is also available here :
http://ns3314.ovh.net/~dom/
sqlite_udf_encode_binary_bug.php.txt
Reproduce code:
---------------
<?
$db = new SQLiteDatabase("/db/bug.db");
$db->queryExec("BEGIN;");
$db->queryExec("CREATE TABLE files_chunks (data blob NOT NULL DEFAULT
'', id INTEGER);");
$chunk_b64 =
"////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////!
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////!
/////////////////////////////////////////////////////////////!
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////!
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////1fz/stzYRENRREJLPURNP0BNQUFGOzxJOzM5OzQ6OztDO0FGNzpPPEBFODZEPDlEPDM6ODQ8ODU4OC03PDNAO0JMO0FJOz9NOzpIOzlMOkBMOzpKO0BGOkI+QTM6NzlIODM9ODlIPDREOzhHO0BJO0BMNjpMOzpHNzZENkFJPD9MOj5PNjhENzhFPC45OCUjOCY3NygvPDIwNzEnPCclNycyODMvMScwPDAxNzAvPDY1NzAuOTcuODA0PSU0ODI0MjE0OjA1MjEuODAuOTEuNzUuODk0MTQ6Ny4zOztBNzM5Nzg+OS9BQjFAU1xocniQhpypkqa2o7nMpbvLpr";
$daFile = base64_decode($chunk_b64);
$db->queryExec("INSERT INTO files_chunks (id, data) VALUES (1,
'".sqlite_udf_encode_binary($daFile)."');") or die("failed");
$db->queryExec("ROLLBACK;");
?>
--
Edit bug report at http://bugs.php.net/?id=32204&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32204&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32204&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32204&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32204&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32204&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32204&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32204&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32204&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32204&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32204&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32204&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32204&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32204&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32204&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32204&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32204&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32204&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32204&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32204&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32204&r=mysqlcfg