<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>38935</bug_id>
          
          <creation_ts>2010-05-11 14:38:21 -0700</creation_ts>
          <short_desc>[Qt][Symbian] data URIs cause crash at QFile layer</short_desc>
          <delta_ts>2010-05-14 08:24:48 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Qt</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>S60 Hardware</rep_platform>
          <op_sys>S60 3rd edition</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Qt</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Siddharth Mathur">s.mathur</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>hausmann</cc>
    
    <cc>kenneth</cc>
    
    <cc>laszlo.gombos</cc>
    
    <cc>markus</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>224165</commentid>
    <comment_count>0</comment_count>
      <attachid>55759</attachid>
    <who name="Siddharth Mathur">s.mathur</who>
    <bug_when>2010-05-11 14:38:21 -0700</bug_when>
    <thetext>Created attachment 55759
repro case

[reporting on behalf of Jyri-Petteri Huttunen and Tom Hechang as reported on s60qt mailing list. The fix might be cross-platform, if QtWebkit can be changed to avoid involving QFile at all in case of data URIs]


Use case: 
---------
We currently have an issue related to showing image in base64 format in Qwebkit. We create a simple qt application which has a qwebview and load a pic.html. The application run normally on windows, and will show a red cross on screen.

While we build the application on symbian^3/4, it will crash when start the app. We are wondering if this is a bug for qt webkit. The pic.html is attached. 


Prelim analysis by Shane Kearns: 
-------------------------------

The findBackend() function calls each backend factory in an iterator.
The first one to successfully process the request is used.
 
The file backend calls QFileInfo(&quot;data:.......&quot;).exists() which crashes inside open C.
open C needs to check the length of filenames passed to stat(), fopen() etc to prevent a buffer overrun panic when it is asked for a filename that is longer than the OS can support.
 
Once open C is fixed, then the exists() function would return false; and the data backend would be tried (and presumably succeed).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>224235</commentid>
    <comment_count>1</comment_count>
    <who name="Laszlo Gombos">laszlo.gombos</who>
    <bug_when>2010-05-11 16:16:46 -0700</bug_when>
    <thetext>If this can not be addressed in OpenC - or lower in the stack - (which seems to be the best place), we should consider trying to address it in QtCore/QFileInfo before looking into changing QtWebKit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225725</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Hausmann">hausmann</who>
    <bug_when>2010-05-14 02:21:29 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; If this can not be addressed in OpenC - or lower in the stack - (which seems to be the best place), we should consider trying to address it in QtCore/QFileInfo before looking into changing QtWebKit.

I agree, this is not a QtWebKit issue at all. I think we should close this bug report.

Markus, what do you think about avoiding the stat on Qt?

Even though I agree that OpenC shouldn&apos;t crash (d&apos;oh!), we shouldn&apos;t call QFileInfo::exists on data urls either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225736</commentid>
    <comment_count>3</comment_count>
    <who name="Markus Goetz">markus</who>
    <bug_when>2010-05-14 03:08:18 -0700</bug_when>
    <thetext>I can try work around it in Qt, but OpenC needs to fix this too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225740</commentid>
    <comment_count>4</comment_count>
    <who name="Markus Goetz">markus</who>
    <bug_when>2010-05-14 03:45:40 -0700</bug_when>
    <thetext>Actually this uncovered a &quot;bug&quot; in Qt. Fix is pending in Qt 4.6 staging repo as c1423c03d69f51d76b3629f2fedce555696759fa

This bug can be closed as soon it has been re-tested with a Qt with this commit. The patch is at http://qt.pastebin.com/XkRBg7dL ..

Still OpenC must not crash for too long filenames.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225826</commentid>
    <comment_count>5</comment_count>
    <who name="Siddharth Mathur">s.mathur</who>
    <bug_when>2010-05-14 08:10:46 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Actually this uncovered a &quot;bug&quot; in Qt. Fix is pending in Qt 4.6 staging repo as c1423c03d69f51d76b3629f2fedce555696759fa
&gt; 
&gt; This bug can be closed as soon it has been re-tested with a Qt with this commit. The patch is at http://qt.pastebin.com/XkRBg7dL ..
&gt; 
&gt; Still OpenC must not crash for too long filenames.

Does the above change fix the problem that file-system shouldn&apos;t be pinged at all when the raw image data is already supplied? 

If the file-system is still being touched, it is a performance problem. For 100 such icons, 0.001 seconds will be for decoding images and blitting them, 2 seconds for stat()ing files. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225828</commentid>
    <comment_count>6</comment_count>
    <who name="Markus Goetz">markus</who>
    <bug_when>2010-05-14 08:16:40 -0700</bug_when>
    <thetext>Don&apos;t worry :)
The order is now the &quot;correct&quot; one:

static void ensureInitialized()
{
#ifndef QT_NO_HTTP
    (void) httpBackend();
#endif // QT_NO_HTTP
    (void) dataBackend();
#ifndef QT_NO_FTP
    (void) ftpBackend();
#endif

#ifdef QT_BUILD_INTERNAL
    (void) debugpipeBackend();
#endif

    // leave this one last since it will query the special QAbstractFileEngines
    (void) fileBackend();
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225831</commentid>
    <comment_count>7</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2010-05-14 08:23:56 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; Don&apos;t worry :)
&gt; The order is now the &quot;correct&quot; one:
&gt; 
&gt; static void ensureInitialized()
&gt; {
&gt; #ifndef QT_NO_HTTP
&gt;     (void) httpBackend();
&gt; #endif // QT_NO_HTTP
&gt;     (void) dataBackend();
&gt; #ifndef QT_NO_FTP
&gt;     (void) ftpBackend();
&gt; #endif
&gt; 
&gt; #ifdef QT_BUILD_INTERNAL
&gt;     (void) debugpipeBackend();
&gt; #endif
&gt; 
&gt;     // leave this one last since it will query the special QAbstractFileEngines
&gt;     (void) fileBackend();
&gt; }

So it is fixed now? Can we close this bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225832</commentid>
    <comment_count>8</comment_count>
    <who name="Siddharth Mathur">s.mathur</who>
    <bug_when>2010-05-14 08:24:48 -0700</bug_when>
    <thetext>OpenC to fix their crash in TRLM-84XDAF 
QtNetwork fix in c1423c03d69f51d76b3629f2fedce555696759fa 
(thanks Markus! :) )</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>55759</attachid>
            <date>2010-05-11 14:38:21 -0700</date>
            <delta_ts>2010-05-11 14:38:21 -0700</delta_ts>
            <desc>repro case</desc>
            <filename>pic.html</filename>
            <type>text/html</type>
            <size>1243</size>
            <attacher name="Siddharth Mathur">s.mathur</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgVHJhbnNpdGlvbmFs
Ly9FTiINCiJodHRwOi8vd3d3LnczLm9yZy9UUi94aHRtbDEvRFREL3hodG1sMS10cmFuc2l0aW9u
YWwuZHRkIj4NCjxodG1sIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIj4NCiAg
ICA8aGVhZD4NCiAgICAgICAgPHRpdGxlPjwvdGl0bGU+DQogICAgICAgICAgICAgICAgPG1ldGEg
aHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9VVRG
LTgiIC8+ICAgICAgICAgICANCiAgICA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