Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Thread Closed 
Solved: Thumbnail Generator Issue in 9.0.0
#30
(05-28-2024, 08:06 PM)ftw64 Wrote: Hi Tim,

I think this is as far as I can get with my poor knowledge of PHP.

I have added this code to /var/www/util/thumb-gen.php near line 319;


Code:
workerLog('thumb-gen: getImage(): 5');

                                if (isset($id3v2->apic)) {
                                        //workerLog('thmcache; mp3: id3v2: apic->imageData: length: ' . strlen($id3v2->apic->imageData));
workerLog('thumb-gen: getImage(): 10, imageData = |' . $id3v2->apic->imageData . '|' );
                                        $image = outImage($id3v2->apic->mimeType, $id3v2->apic->imageData);
workerLog('thumb-gen: getImage(): 11, image = |' . $image . '|');
// $image = false;
                                }
                        }

The last lines in moode.log read (when opening with vi to see the unprintable characters):


Code:
20240528 215710 thumb-gen: getImage(): 5
20240528 215710 thumb-gen: getImage(): 10, imageData = |^@^@^@^@|
20240528 215710 thumb-gen: outImage(): image/jpg, 4 bytes
20240528 215710 thumb-gen: getImage(): 11, image = |^@^@^@^@|

After that, the thumbnail generator seems to crash in file_get_contents() at line 168:


Code:
        if (strlen($imgStr) < 512) {
workerLog('thumb-gen: 11, imgStr = ' .$imgStr);
                //workerLog('thumb-gen: Image file: ' . $imgStr);
                $imgStr = file_get_contents($imgStr);
workerLog('thumb-gen: 12');
        }

Moode.log continues:


Code:
20240528 215710 thumb-gen: 10
20240528 215710 thumb-gen: 11, imgStr = ^@^@^@^@

But never prints 'thumb-gen: 12'.

I'm hoping for a solution as I really like MoOde Audio! It might be that the Zend Framework needs to be updated with PHP8?


With best regards,
-Frank

It looks like nulls and any other bad data in the path arg for file_get_contents() causes crash.

Example: Crashing the php shell.


Code:
php > $tim = file_get_contents("\00");
PHP Warning:  Uncaught ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes in php shell code:1
Stack trace:
#0 php shell code(1): file_get_contents()
#1 {main}
 thrown in php shell code on line 1
php >

The fix is to check for a valid file path instead of using the assumption in the "if: statement that if length is < 512 it must be a path and not actual image data.


Code:
if (strlen($imgStr) < 512)

I'll fix for upcoming r901
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub


Messages In This Thread
Thumbnail Generator Issue in 9.0.0 - by haeckse - 05-22-2024, 03:28 PM
RE: Thumbnail Generator Issue in 9.0.0 - by radu- - 05-23-2024, 08:45 AM
RE: Thumbnail Generator Issue in 9.0.0 - by radu- - 05-23-2024, 12:21 PM
RE: Thumbnail Generator Issue in 9.0.0 - by radu- - 05-24-2024, 09:44 AM
RE: Thumbnail Generator Issue in 9.0.0 - by Nutul - 05-27-2024, 12:38 PM
RE: Thumbnail Generator Issue in 9.0.0 - by Mattt - 05-27-2024, 07:43 PM
RE: Thumbnail Generator Issue in 9.0.0 - by ftw64 - 05-27-2024, 08:30 PM
RE: Thumbnail Generator Issue in 9.0.0 - by ftw64 - 05-28-2024, 06:23 PM
RE: Thumbnail Generator Issue in 9.0.0 - by ftw64 - 05-28-2024, 07:06 PM
RE: Thumbnail Generator Issue in 9.0.0 - by ftw64 - 05-28-2024, 07:20 PM
RE: Thumbnail Generator Issue in 9.0.0 - by ftw64 - 05-28-2024, 08:06 PM
RE: Thumbnail Generator Issue in 9.0.0 - by Tim Curtis - 05-28-2024, 08:46 PM
RE: Thumbnail Generator Issue in 9.0.0 - by ftw64 - 05-29-2024, 05:59 PM
RE: Thumbnail Generator Issue in 9.0.0 - by Nutul - 05-28-2024, 08:25 PM
RE: Thumbnail Generator Issue in 9.0.0 - by Nutul - 05-28-2024, 08:32 PM
RE: Thumbnail Generator Issue in 9.0.0 - by ftw64 - 05-31-2024, 08:02 PM
RE: Thumbnail Generator Issue in 9.0.0 - by radu- - 06-03-2024, 06:31 AM

Forum Jump: