php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67297 Pdo-MySql Insert (escaping) bug
Submitted: 2014-05-17 11:41 UTC Modified: 2016-08-28 04:22 UTC
Votes:3
Avg. Score:3.0 ± 1.6
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: genuser at gmx dot net Assigned: cmb (profile)
Status: No Feedback Package: PCRE related
PHP Version: 5.5.12 OS: Debian GNU/Linux 7.5 (wheezy)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: genuser at gmx dot net
New email:
PHP Version: OS:

 

 [2014-05-17 11:41 UTC] genuser at gmx dot net
Description:
------------
Hey there,
php running into an segmentation fault.
I try to insert a json record into my database and mybe pcre become a problem by escaping?


Test script:
---------------
I'm try to import this by Mysql Pdo.


Example-Part of sql insert:
'{\"WahlartenLang\":\"\",\"WahlartenKurz\":\"RG,KT,GR,GR+\",\"PostfreimachungVersandta\":\"0\",\"Wahlkreisnummer\":\"09\",\"Wahlbezirksnummer\":\"05041\",\"Waehlernummer\":\"110\",\"Familienname\":\"Schm\\u00f6lling\",\"Vorname\":\"Patrick\",\"Strassenschluessel\":\"76018\", ............

Expected result:
----------------
Successful database insert and no segmentation fault.

Actual result:
--------------
=============================
Program received signal SIGSEGV, Segmentation fault.
=============================
0x000000000048343b in match (eptr=0x18257d2 "785);\n;", ecode=0x122b797 "\035\"x",
    mstart=0x1822719 "\"WahlartenLang\\\":\\\"\\\",\\\"WahlartenKurz\\\":\\\"RG,KT,GR,GR+\\\",\\\"PostfreimachungVersandta\\\":\\\"0\\\",\\\"Wahlkreisnummer\\\":\\\"09\\\",\\\"Wahlbezirksnummer\\\":\\\"05041\\\",\\\"Waehlernummer\\\":\\\"110\\\",\\\"Familienname\\\":\\\"Schm"..., offset_top=4, md=0x7fffffff90a0, eptrb=0x0, rdepth=10890) at /usr/src/php5.5/source/php5-5.5.12/ext/pcre/pcrelib/pcre_exec.c:1802
1802    /usr/src/php5.5/source/php5-5.5.12/ext/pcre/pcrelib/pcre_exec.c: Datei oder Verzeichnis nicht gefunden.

=============================
Part of Backtrace
=============================
#0  0x000000000048343b in match (eptr=0x18257d2 "785);\n;", ecode=0x122b797 "\035\"x",
    mstart=0x1822719 "\"WahlartenLang\\\":\\\"\\\",\\\"WahlartenKurz\\\":\\\"RG,KT,GR,GR+\\\",\\\"PostfreimachungVersandta\\\":\\\"0\\\",\\\"Wahlkreisnummer\\\":\\\"09\\\",\\\"Wahlbezirksnummer\\\":\\\"05041\\\",\\\"Waehlernummer\\\":\\\"110\\\",\\\"Familienname\\\":\\\"Schm"..., offset_top=4, md=0x7fffffff90a0, eptrb=0x0, rdepth=10890) at /usr/src/php5.5/source/php5-5.5.12/ext/pcre/pcrelib/pcre_exec.c:1802
#1  0x0000000000493f0e in match (eptr=0x18257d2 "785);\n;", ecode=0x122b794 "z",
    mstart=0x1822719 "\"WahlartenLang\\\":\\\"\\\",\\\"WahlartenKurz\\\":\\\"RG,KT,GR,GR+\\\",\\\"PostfreimachungVersandta\\\":\\\"0\\\",\\\"Wahlkreisnummer\\\":\\\"09\\\",\\\"Wahlbezirksnummer\\\":\\\"05041\\\",\\\"Waehlernummer\\\":\\\"110\\\",\\\"Familienname\\\":\\\"Schm"..., offset_top=4, md=<optimized out>, eptrb=0x0, rdepth=10889) at /usr/src/php5.5/source/php5-5.5.12/ext/pcre/pcrelib/pcre_exec.c:2024
.
.
.
.
.

#10891 0x000000000049524f in php_pcre_exec (argument_re=0x122b740, extra_data=extra_data@entry=0x7fffffff9310,
    subject=subject@entry=0x18226c0 "INSERT INTO job_detail \n(job_id, print_id, state_date, record, state_id) \nVALUES \n(,,,'{\\\"WahlartenLang\\\":\\\"\\\",\\\"WahlartenKurz\\\":\\\"RG,KT,GR,GR+\\\",\\\"PostfreimachungVersandta\\\":\\\"0\\\",\\\"Wahlkreisnummer\\\""..., length=length@entry=12569, start_offset=start_offset@entry=0, options=0, offsets=offsets@entry=0x142ba28, offsetcount=offsetcount@entry=6) at /usr/src/php5.5/source/php5-5.5.12/ext/pcre/pcrelib/pcre_exec.c:6945
#10892 0x000000000049aed3 in php_pcre_replace_impl (pce=0x122b820,
    subject=0x18226c0 "INSERT INTO job_detail \n(job_id, print_id, state_date, record, state_id) \nVALUES \n(,,,'{\\\"WahlartenLang\\\":\\\"\\\",\\\"WahlartenKurz\\\":\\\"RG,KT,GR,GR+\\\",\\\"PostfreimachungVersandta\\\":\\\"0\\\",\\\"Wahlkreisnummer\\\""...,
    subject_len=12569, replace_val=replace_val@entry=0x17d1a20, is_callable_replace=is_callable_replace@entry=0, result_len=0x7fffffff9450, limit=-1, replace_count=0x7fffffff9454) at /usr/src/php5.5/source/php5-5.5.12/ext/pcre/php_pcre.c:1091
#10893 0x000000000049bc5f in php_pcre_replace (regex=<optimized out>, regex_len=<optimized out>, subject=<optimized out>, subject_len=<optimized out>, replace_val=replace_val@entry=0x17d1a20, is_callable_replace=is_callable_replace@entry=0, result_len=0x7fffffffffff,
    result_len@entry=0x7fffffff9450, limit=-27564, limit@entry=-1, replace_count=replace_count@entry=0x7fffffff9454) at /usr/src/php5.5/source/php5-5.5.12/ext/pcre/php_pcre.c:997

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-20 13:15 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-08-20 13:15 UTC] cmb@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.
 [2016-08-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 14:01:27 2024 UTC