Changeset 79

Show
Ignore:
Timestamp:
09/12/09 07:56:09 (6 months ago)
Author:
cristy
Message:
 
Location:
ImageMagick/trunk/coders
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • ImageMagick/trunk/coders/cmyk.c

    r1 r79  
    215215            length=GetQuantumExtent(canvas_image,quantum_info,quantum_type); 
    216216            count=ReadBlob(image,length,pixels); 
    217             if (count != (ssize_t) length) 
    218               break; 
    219217          } 
    220218        for (y=0; y < (long) image->extract_info.height; y++) 
     
    235233            *__restrict q; 
    236234 
     235          if (count != (ssize_t) length) 
     236            { 
     237              ThrowFileException(exception,CorruptImageError, 
     238                "UnexpectedEndOfFile",image->filename); 
     239              break; 
     240            } 
    237241          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    238242            exception); 
     
    277281            } 
    278282          count=ReadBlob(image,length,pixels); 
    279           if (count != (ssize_t) length) 
    280             break; 
    281283        } 
    282284        break; 
     
    301303            length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum); 
    302304            count=ReadBlob(image,length,pixels); 
    303             if (count != (ssize_t) length) 
    304               break; 
    305305          } 
    306306        for (y=0; y < (long) image->extract_info.height; y++) 
     
    321321            *__restrict q; 
    322322 
     323          if (count != (ssize_t) length) 
     324            { 
     325              ThrowFileException(exception,CorruptImageError, 
     326                "UnexpectedEndOfFile",image->filename); 
     327              break; 
     328            } 
    323329          for (i=0; i < (image->matte != MagickFalse ? 5 : 4); i++) 
    324330          { 
     
    363369              } 
    364370            count=ReadBlob(image,length,pixels); 
    365             if (count != (ssize_t) length) 
    366               break; 
    367371          } 
    368372          if (image->previous == (Image *) NULL) 
     
    384388            length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum); 
    385389            count=ReadBlob(image,length,pixels); 
    386             if (count != (ssize_t) length) 
    387               break; 
    388390          } 
    389391        for (y=0; y < (long) image->extract_info.height; y++) 
     
    398400            *__restrict q; 
    399401 
     402          if (count != (ssize_t) length) 
     403            { 
     404              ThrowFileException(exception,CorruptImageError, 
     405                "UnexpectedEndOfFile",image->filename); 
     406              break; 
     407            } 
    400408          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    401409            exception); 
     
    426434            } 
    427435          count=ReadBlob(image,length,pixels); 
    428           if (count != (ssize_t) length) 
    429             break; 
    430436        } 
    431437        if (image->previous == (Image *) NULL) 
     
    446452            *__restrict q; 
    447453 
     454          if (count != (ssize_t) length) 
     455            { 
     456              ThrowFileException(exception,CorruptImageError, 
     457                "UnexpectedEndOfFile",image->filename); 
     458              break; 
     459            } 
    448460          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    449461            exception); 
     
    474486           } 
    475487          count=ReadBlob(image,length,pixels); 
    476           if (count != (ssize_t) length) 
    477             break; 
    478488        } 
    479489        if (image->previous == (Image *) NULL) 
     
    494504            *__restrict q; 
    495505 
     506          if (count != (ssize_t) length) 
     507            { 
     508              ThrowFileException(exception,CorruptImageError, 
     509                "UnexpectedEndOfFile",image->filename); 
     510              break; 
     511            } 
    496512          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    497513            exception); 
     
    522538            } 
    523539          count=ReadBlob(image,length,pixels); 
    524           if (count != (ssize_t) length) 
    525             break; 
    526540        } 
    527541        if (image->previous == (Image *) NULL) 
     
    548562            *__restrict q; 
    549563 
     564          if (count != (ssize_t) length) 
     565            { 
     566              ThrowFileException(exception,CorruptImageError, 
     567                "UnexpectedEndOfFile",image->filename); 
     568              break; 
     569            } 
    550570          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    551571            exception); 
     
    578598            } 
    579599          count=ReadBlob(image,length,pixels); 
    580           if (count != (ssize_t) length) 
    581             break; 
    582600        } 
    583601        if (image->previous == (Image *) NULL) 
     
    600618                *__restrict q; 
    601619 
     620              if (count != (ssize_t) length) 
     621                { 
     622                  ThrowFileException(exception,CorruptImageError, 
     623                    "UnexpectedEndOfFile",image->filename); 
     624                  break; 
     625                } 
    602626              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    603627                exception); 
     
    629653                } 
    630654              count=ReadBlob(image,length,pixels); 
    631               if (count != (ssize_t) length) 
    632                 break; 
    633655            } 
    634656            if (image->previous == (Image *) NULL) 
     
    677699              } 
    678700        count=ReadBlob(image,length,pixels); 
    679         if (count != (ssize_t) length) 
    680           break; 
    681701        for (y=0; y < (long) image->extract_info.height; y++) 
    682702        { 
     
    690710            *__restrict q; 
    691711 
     712          if (count != (ssize_t) length) 
     713            { 
     714              ThrowFileException(exception,CorruptImageError, 
     715                "UnexpectedEndOfFile",image->filename); 
     716              break; 
     717            } 
    692718          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    693719            exception); 
     
    718744            } 
    719745          count=ReadBlob(image,length,pixels); 
    720           if (count != (ssize_t) length) 
    721             break; 
    722746        } 
    723747        if (image->previous == (Image *) NULL) 
     
    746770              } 
    747771        count=ReadBlob(image,length,pixels); 
    748         if (count != (ssize_t) length) 
    749           break; 
    750772        for (y=0; y < (long) image->extract_info.height; y++) 
    751773        { 
     
    759781            *__restrict q; 
    760782 
     783          if (count != (ssize_t) length) 
     784            { 
     785              ThrowFileException(exception,CorruptImageError, 
     786                "UnexpectedEndOfFile",image->filename); 
     787              break; 
     788            } 
    761789          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    762790            exception); 
     
    787815           } 
    788816          count=ReadBlob(image,length,pixels); 
    789           if (count != (ssize_t) length) 
    790             break; 
    791817        } 
    792818        if (image->previous == (Image *) NULL) 
     
    815841              } 
    816842        count=ReadBlob(image,length,pixels); 
    817         if (count != (ssize_t) length) 
    818           break; 
    819843        for (y=0; y < (long) image->extract_info.height; y++) 
    820844        { 
     
    828852            *__restrict q; 
    829853 
     854          if (count != (ssize_t) length) 
     855            { 
     856              ThrowFileException(exception,CorruptImageError, 
     857                "UnexpectedEndOfFile",image->filename); 
     858              break; 
     859            } 
    830860          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    831861            exception); 
     
    856886           } 
    857887          count=ReadBlob(image,length,pixels); 
    858           if (count != (ssize_t) length) 
    859             break; 
    860888        } 
    861889        if (image->previous == (Image *) NULL) 
     
    884912              } 
    885913        count=ReadBlob(image,length,pixels); 
    886         if (count != (ssize_t) length) 
    887           break; 
    888914        for (y=0; y < (long) image->extract_info.height; y++) 
    889915        { 
     
    903929            *__restrict q; 
    904930 
     931          if (count != (ssize_t) length) 
     932            { 
     933              ThrowFileException(exception,CorruptImageError, 
     934                "UnexpectedEndOfFile",image->filename); 
     935              break; 
     936            } 
    905937          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    906938            exception); 
     
    933965           } 
    934966          count=ReadBlob(image,length,pixels); 
    935           if (count != (ssize_t) length) 
    936             break; 
    937967        } 
    938968        if (image->previous == (Image *) NULL) 
     
    963993                  } 
    964994            count=ReadBlob(image,length,pixels); 
    965             if (count != (ssize_t) length) 
    966               break; 
    967995            for (y=0; y < (long) image->extract_info.height; y++) 
    968996            { 
     
    9761004                *__restrict q; 
    9771005 
     1006              if (count != (ssize_t) length) 
     1007                { 
     1008                  ThrowFileException(exception,CorruptImageError, 
     1009                    "UnexpectedEndOfFile",image->filename); 
     1010                  break; 
     1011                } 
    9781012              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    9791013                exception); 
     
    10041038               } 
    10051039              count=ReadBlob(image,length,pixels); 
    1006               if (count != (ssize_t) length) 
    1007                 break; 
    10081040            } 
    10091041            if (image->previous == (Image *) NULL) 
  • ImageMagick/trunk/coders/rgb.c

    r75 r79  
    256256            *__restrict q; 
    257257 
     258          if (count != (ssize_t) length) 
     259            { 
     260              ThrowFileException(exception,CorruptImageError, 
     261                "UnexpectedEndOfFile",image->filename); 
     262              break; 
     263            } 
    258264          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    259265            exception); 
     
    303309            } 
    304310          count=ReadBlob(image,length,pixels); 
    305           if (count != (ssize_t) length) 
    306             break; 
    307311        } 
    308312        break; 
     
    317321            length=GetQuantumExtent(canvas_image,quantum_info,quantum_types[0]); 
    318322            count=ReadBlob(image,length,pixels); 
    319             if (count != (ssize_t) length) 
    320               break; 
    321323          } 
    322324        for (y=0; y < (long) image->extract_info.height; y++) 
     
    331333            *__restrict q; 
    332334 
     335          if (count != (ssize_t) length) 
     336            { 
     337              ThrowFileException(exception,CorruptImageError, 
     338                "UnexpectedEndOfFile",image->filename); 
     339              break; 
     340            } 
    333341          for (i=0; i < channels; i++) 
    334342          { 
     
    365373              } 
    366374            count=ReadBlob(image,length,pixels); 
    367             if (count != (ssize_t) length) 
    368               break; 
    369375          } 
    370376          if (image->previous == (Image *) NULL) 
     
    386392            length=GetQuantumExtent(canvas_image,quantum_info,quantum_types[0]); 
    387393            count=ReadBlob(image,length,pixels); 
    388             if (count != (ssize_t) length) 
    389               break; 
    390394          } 
    391395        for (i=0; i < channels; i++) 
     
    402406              *__restrict q; 
    403407 
     408            if (count != (ssize_t) length) 
     409              { 
     410                ThrowFileException(exception,CorruptImageError, 
     411                  "UnexpectedEndOfFile",image->filename); 
     412                break; 
     413              } 
    404414            q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    405415              exception); 
     
    438448              } 
    439449            count=ReadBlob(image,length,pixels); 
    440             if (count != (ssize_t) length) 
    441               break; 
    442450          } 
    443451          if (image->previous == (Image *) NULL) 
     
    490498                } 
    491499          count=ReadBlob(image,length,pixels); 
    492           if (count != (ssize_t) length) 
    493             break; 
    494500          for (y=0; y < (long) image->extract_info.height; y++) 
    495501          { 
     
    503509              *__restrict q; 
    504510 
     511            if (count != (ssize_t) length) 
     512              { 
     513                ThrowFileException(exception,CorruptImageError, 
     514                  "UnexpectedEndOfFile",image->filename); 
     515                break; 
     516              } 
    505517            q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    506518              exception); 
     
    539551              } 
    540552            count=ReadBlob(image,length,pixels); 
    541             if (count != (ssize_t) length) 
    542               break; 
    543553          } 
    544554          if (image->previous == (Image *) NULL) 
  • ImageMagick/trunk/coders/ycbcr.c

    r75 r79  
    222222            length=GetQuantumExtent(canvas_image,quantum_info,quantum_type); 
    223223            count=ReadBlob(image,length,pixels); 
    224             if (count != (ssize_t) length) 
    225               break; 
    226224          } 
    227225        for (y=0; y < (long) image->extract_info.height; y++) 
    228226        { 
     227          if (count != (ssize_t) length) 
     228            { 
     229              ThrowFileException(exception,CorruptImageError, 
     230                "UnexpectedEndOfFile",image->filename); 
     231              break; 
     232            } 
    229233          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    230234            exception); 
     
    265269            } 
    266270          count=ReadBlob(image,length,pixels); 
    267           if (count != (ssize_t) length) 
    268             break; 
    269271        } 
    270272        break; 
     
    288290            length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum); 
    289291            count=ReadBlob(image,length,pixels); 
     292          } 
     293        for (y=0; y < (long) image->extract_info.height; y++) 
     294        { 
     295          for (i=0; i < (image->matte != MagickFalse ? 4 : 3); i++) 
     296          { 
    290297            if (count != (ssize_t) length) 
    291               break; 
    292           } 
    293         for (y=0; y < (long) image->extract_info.height; y++) 
    294         { 
    295           for (i=0; i < (image->matte != MagickFalse ? 4 : 3); i++) 
    296           { 
     298              { 
     299                ThrowFileException(exception,CorruptImageError, 
     300                  "UnexpectedEndOfFile",image->filename); 
     301                break; 
     302              } 
    297303            quantum_type=quantum_types[i]; 
    298304            q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
     
    331337              } 
    332338            count=ReadBlob(image,length,pixels); 
    333             if (count != (ssize_t) length) 
    334               break; 
    335339          } 
    336340          if (image->previous == (Image *) NULL) 
     
    352356            length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum); 
    353357            count=ReadBlob(image,length,pixels); 
    354             if (count != (ssize_t) length) 
    355               break; 
    356358          } 
    357359        for (y=0; y < (long) image->extract_info.height; y++) 
    358360        { 
     361          if (count != (ssize_t) length) 
     362            { 
     363              ThrowFileException(exception,CorruptImageError, 
     364                "UnexpectedEndOfFile",image->filename); 
     365              break; 
     366            } 
    359367          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    360368            exception); 
     
    385393            } 
    386394          count=ReadBlob(image,length,pixels); 
    387           if (count != (ssize_t) length) 
    388             break; 
    389395        } 
    390396        if (image->previous == (Image *) NULL) 
     
    396402        for (y=0; y < (long) image->extract_info.height; y++) 
    397403        { 
     404          if (count != (ssize_t) length) 
     405            { 
     406              ThrowFileException(exception,CorruptImageError, 
     407                "UnexpectedEndOfFile",image->filename); 
     408              break; 
     409            } 
    398410          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    399411            exception); 
     
    424436           } 
    425437          count=ReadBlob(image,length,pixels); 
    426           if (count != (ssize_t) length) 
    427             break; 
    428438        } 
    429439        if (image->previous == (Image *) NULL) 
     
    435445        for (y=0; y < (long) image->extract_info.height; y++) 
    436446        { 
     447          if (count != (ssize_t) length) 
     448            { 
     449              ThrowFileException(exception,CorruptImageError, 
     450                "UnexpectedEndOfFile",image->filename); 
     451              break; 
     452            } 
    437453          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    438454            exception); 
     
    463479            } 
    464480          count=ReadBlob(image,length,pixels); 
    465           if (count != (ssize_t) length) 
    466             break; 
    467481        } 
    468482        if (image->previous == (Image *) NULL) 
     
    476490            for (y=0; y < (long) image->extract_info.height; y++) 
    477491            { 
     492              if (count != (ssize_t) length) 
     493                { 
     494                  ThrowFileException(exception,CorruptImageError, 
     495                    "UnexpectedEndOfFile",image->filename); 
     496                  break; 
     497                } 
    478498              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    479499                exception); 
     
    505525                } 
    506526              count=ReadBlob(image,length,pixels); 
    507               if (count != (ssize_t) length) 
    508                 break; 
    509527            } 
    510528            if (image->previous == (Image *) NULL) 
     
    553571              } 
    554572        count=ReadBlob(image,length,pixels); 
    555         if (count != (ssize_t) length) 
    556           break; 
    557573        for (y=0; y < (long) image->extract_info.height; y++) 
    558574        { 
     575          if (count != (ssize_t) length) 
     576            { 
     577              ThrowFileException(exception,CorruptImageError, 
     578                "UnexpectedEndOfFile",image->filename); 
     579              break; 
     580            } 
    559581          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    560582            exception); 
     
    585607            } 
    586608          count=ReadBlob(image,length,pixels); 
    587           if (count != (ssize_t) length) 
    588             break; 
    589609        } 
    590610        if (image->previous == (Image *) NULL) 
     
    613633              } 
    614634        count=ReadBlob(image,length,pixels); 
    615         if (count != (ssize_t) length) 
    616           break; 
    617635        for (y=0; y < (long) image->extract_info.height; y++) 
    618636        { 
     637          if (count != (ssize_t) length) 
     638            { 
     639              ThrowFileException(exception,CorruptImageError, 
     640                "UnexpectedEndOfFile",image->filename); 
     641              break; 
     642            } 
    619643          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    620644            exception); 
     
    645669           } 
    646670          count=ReadBlob(image,length,pixels); 
    647           if (count != (ssize_t) length) 
    648             break; 
    649671        } 
    650672        if (image->previous == (Image *) NULL) 
     
    673695              } 
    674696        count=ReadBlob(image,length,pixels); 
    675         if (count != (ssize_t) length) 
    676           break; 
    677697        for (y=0; y < (long) image->extract_info.height; y++) 
    678698        { 
     699          if (count != (ssize_t) length) 
     700            { 
     701              ThrowFileException(exception,CorruptImageError, 
     702                "UnexpectedEndOfFile",image->filename); 
     703              break; 
     704            } 
    679705          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    680706            exception); 
     
    705731           } 
    706732          count=ReadBlob(image,length,pixels); 
    707           if (count != (ssize_t) length) 
    708             break; 
    709733        } 
    710734        if (image->previous == (Image *) NULL) 
     
    735759                  } 
    736760            count=ReadBlob(image,length,pixels); 
    737             if (count != (ssize_t) length) 
    738               break; 
    739761            for (y=0; y < (long) image->extract_info.height; y++) 
    740762            { 
     763              if (count != (ssize_t) length) 
     764                { 
     765                  ThrowFileException(exception,CorruptImageError, 
     766                    "UnexpectedEndOfFile",image->filename); 
     767                  break; 
     768                } 
    741769              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1, 
    742770                exception); 
     
    768796               } 
    769797              count=ReadBlob(image,length,pixels); 
    770               if (count != (ssize_t) length) 
    771                 break; 
    772798            } 
    773799            if (image->previous == (Image *) NULL)