php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32204 sqlite_udf_encode_binary fails to escape some chunks
Submitted: 2005-03-06 12:21 UTC Modified: 2005-03-06 16:13 UTC
From: php at lachoseinteractive dot net Assigned:
Status: Not a bug Package: SQLite related
PHP Version: 5.0.3 OS: Mac OS X 10.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at lachoseinteractive dot net
New email:
PHP Version: OS:

 

 [2005-03-06 12:21 UTC] php at lachoseinteractive dot net
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;");

?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-06 13:31 UTC] php at lachoseinteractive dot net
Forget about it. sqlite_udf_encode_binary is not 
supposed to escape quotes :-/
 [2005-03-06 16:13 UTC] sniper@php.net
Forgot.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC