Segementation fault in object editor

Hello,

i have troubles with our 1.7.11 installation (Debian, PHP 7.3, apache). (DB updated from 1.4)

When i display object editor with "Media representations" block, on some items page loading fails.


In apache error log there is only  [core:notice] [pid 18408] AH00052: child pid 19941 exit signal Segmentation fault (11)

The same occurs on two different servers with slightly different PHP versions (7.3.27 and 7.3.19) and with different major versions of MySql/MariaDb, i have also tried switching from pecl Gmagick to ImageMagick (exec) or GraphicsMagick (exec).

Do you have some tips?

Comments

  • Hi,

    This would be a PHP issue, not anything with MySQL. You might want to try moving up to PHP 7.4 or down to PHP 7.2 and see if that helps. Obviously, no PHP script should be able to make the interpreter (and thus the web server into which it is embedded – I'm assuming that you're running PHP as an Apache module here) crash. These crashes usually are issues in a specific version of PHP itself, and updating to another minor version is often enough to resolve the problem. In your case that's not working, so it might be a larger issue with 7.3 generally.

    If upgrading or downgrading doesn't resolve this, or isn't possible, then the next thing to look at is the metadata on the media being viewed. Various versions of PHP have behaved badly with certain entries of EXIF data from specific devices. Sometimes the errors are silent (Eg. json_encode() returning null with no error set) and sometimes loud (Eg. your segfault). A quick way to test if it's EXIF data triggering the crash is to edit app/lib/RepresentableBaseModel.phpcommenting out lines 1204-1206:

              if ($vs_extracted_metadata = caFormatMediaMetadata(caSanitizeArray(caUnserializeForDatabase($va_rep['media_metadata']), array('removeNonCharacterData' => true)))) {
                $vs_extracted_metadata = "<h3>"._t('Extracted metadata').":</h3>\n{$vs_extracted_metadata}\n";
              }
    

    If the pages load when this code is removed at least we'll know where the problem is.

    If possible, please send me the media from a crashy record, so I can try and reproduce the issue on a different install and server.


    Seth

  • Hello Seth,

    thank you, you are right, problem is there, media_metadata during caSanitizeArray triggers error in the preg_match part.

    (i can skip it for now using if($vn_k=="ImageResourceInformation"||$vn_k=="ICC_Profile") {unset($pa_array[$vn_k]); continue;  }  )

    Following minimal testcase is segfaulting from Apache mod-php and from CLI.

    I will try it on newer version of PHP (and maybe file PHP bug)


    <?php

    $a=unserialize(file_get_contents("exif.txt"));

    $b=$a["EXIF"]["IFD0"]["ImageResourceInformation"];

    //segfault on next line

    $c=preg_match("!^\X+$!", $b);

    echo "OK";


    From https://www.dropbox.com/s/rjtj0d7v7fmi3y0/PHOTO_JMP_F_851_a_original_1.tiff?dl=0 you can view and test one of offending media representations .

  • UPDATE - my testcase is segfaulting in php 7.4... and php 8.0...

    so I have created https://bugs.php.net/bug.php?id=81095

  • Ah very interesting. I'm surprised this one spans so many versions.

Sign In or Register to comment.