<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Crash when trying to save a form using an image bigger than length of Binary fix field"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=138691">bug 138691</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>lionel@mamane.lu, robert@familiegrosskopf.de
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Crash when trying to save a form using an image bigger than length of Binary fix field"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=138691#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Crash when trying to save a form using an image bigger than length of Binary fix field"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=138691">bug 138691</a>
              from <span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span></b>
        <pre>Robert: would you have some minutes to reproduce this?

Lionel: taking a look at the bt, the pb is here:
   1847             case DataType::BINARY:
   1848             case DataType::VARBINARY:
   1849             case DataType::LONGVARBINARY:
   1850             case DataType::BLOB:
   1851                 {
   1852                     Any x(_rValue.makeAny());
   1853                     Sequence< sal_Int8> aBytes;
   1854                     if(x >>= aBytes)
   1855                         _xParams->setBytes(parameterIndex,aBytes);
See
<a href="https://opengrok.libreoffice.org/xref/core/connectivity/source/commontools/dbtools.cxx?r=d6d80c4e#1847">https://opengrok.libreoffice.org/xref/core/connectivity/source/commontools/dbtools.cxx?r=d6d80c4e#1847</a>

after x >>= aBytes, aBytes is just a sequence of 0 because we get over max
size.
So setBytes is called with a 0 size sequence and it crashes.

A simple fix would be to change "if" condition to also test that aBytes is not
a 0 length sequence.
Pb is the user isn't warned about the pb.

Another fix would be to add a specific test length and create a new string
message here:
connectivity/inc/strings.hrc
like:
"The image is too big compared for the field." (it can be greatly improved I
suppose, it's just to give an idea).

I'm pretty sureit's not specific to Firebird but with HSQLDB, as indicated in
initial description, length of the Binary (fix) BINARY is 2147483647 and it's
readonly (I didn't investigate why).

Remark: I don't know how "Any" => "Sequence" conversion takes length into
account to retrieve 0 size when the image is too big.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>