Changeset 653


Ignore:
Timestamp:
Sep 23, 2018, 11:08:29 PM (2 years ago)
Author:
Gregg Young
Message:

Fixes for several load traps and code to prevent attempting to load obviously broken files

Location:
trunk/Lucide/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/gui/lcdfdlg.cpp

    r647 r653  
    253253                            strcat( fn, itemText );
    254254                            previewFile( WinWindowFromID( hwnd, IDC_PREVIEW ), fn );
     255                            short fcr;
     256                            __asm__ volatile ("fstcw        %0 \n"
     257                                              "or      $0x3f, %0 \n"
     258                                              "fldcw        %0 \n"
     259                                              : "=m"(fcr));
     260
    255261                        }
    256262
     
    320326
    321327
    322 #define BUFSIZE      2000
     328//#define BUFSIZE      40000
    323329#define BUFSIZEEAOP2 65000
    324330
     
    339345    count = -1;
    340346
    341     if ( ( pBuffer = (char*)malloc(BUFSIZE) ) != NULL )
    342     {
    343         memset( pBuffer, 127, BUFSIZE );
    344 
    345         if ( DosEnumAttribute( ENUMEA_REFTYPE_PATH, (PSZ)pszPath, 1, pBuffer, BUFSIZE,
    346                                &count, ENUMEA_LEVEL_NO_VALUE ) == 0 )
     347    if ( ( pBuffer = (char*)malloc(65000) ) != NULL )
     348    {
     349        memset( pBuffer, 127, 65000 );
     350        // This was trapping because apparently it isn't high mem safe
     351        // passing the bufsize on the stack fixes the trap
     352        if ( DosEnumAttribute( ENUMEA_REFTYPE_PATH, (PSZ)pszPath, 1, pBuffer,
     353                              65000, &count, ENUMEA_LEVEL_NO_VALUE ) == 0 )
    347354        {
    348355            pDena = (PDENA2)pBuffer;
  • trunk/Lucide/gui/lucide.cpp

    r646 r653  
    481481void Lucide::loadthread( void* )
    482482{
    483     //ScopedExceptqLoader sel;
    484483    HAB thab = WinInitialize( 0 );
    485484    HMQ thmq = WinCreateMsgQueue( thab, 0 );
     
    488487                              &loadError );
    489488
    490 #if 1  //FM2 valid.c 339
     489    //From FM2 valid.c 339
    491490    EASIZEBUF easize    = {0};
    492491    ULONG   ulDataLen   = sizeof(EASIZEBUF);
     
    497496    DosFSCtl(&easize, sizeof(EASIZEBUF), &ulDataLen, NULL, ulParmLen,
    498497             &ulParmLen, FSCTL_MAX_EASIZE, szPath, -1, FSCTL_PATHNAME);
    499 #endif
     498    //End FM2 code
     499
    500500    if ( docLoaded && !password  && Thumbnail && easize.cbMaxEASize > 0 &&
    501501        doc->isCreateFileThumbnail( ev ) && isThumbNeeded( docFullName ) &&
     
    505505            docLoaded = FALSE;
    506506    }
    507 #if 1
     507
    508508    else if ( docLoaded && doc->getPageCount( ev ) > 0 ) {
    509509        double width = 0, height = 0;
    510510        doc->getPageSize( ev, 0, &width, &height );
    511         if ( width > 0 && height > 0 ) {
    512             double zoom;
    513 
    514             if (doc->isScalable( ev ))
    515                 zoom = std::min( (double)256 / width,
    516                                        (double)256 / height );
    517             else
    518                 zoom = 1;
    519             short bpp = doc->getBpp( ev );
    520             long rx = width * zoom;
    521             long ry = height * zoom;
    522             LuPixbuf *pixbuf = new LuPixbuf( ev, rx, ry, bpp );
    523             doc->renderPageToPixbuf( ev, 0, 0, 0, rx, ry, zoom,
    524                                     0, pixbuf, NULL, NULL );
    525             delete pixbuf;
    526         }
    527         else
     511        if ( width <= 0.00001 || height <= 0.00001 )
    528512            docLoaded = FALSE;
    529513    }
    530514    else
    531515        docLoaded = FALSE;
    532 #endif
     516
    533517    ULONG sz = sizeof( bool );
    534518    PrfQueryProfileData( hinilucideprofile, appName, "thumbnail", &Thumbnail, &sz );
     
    19161900    if (Lucide:: hwndHelp )
    19171901        WinAssociateHelpInstance ( Lucide::hwndHelp, hWndFrame );
    1918 
     1902   
    19191903    // Messsage loop
    19201904    while ( WinGetMsg( hab, &qmsg, 0, 0, 0 ) ) {
Note: See TracChangeset for help on using the changeset viewer.