Blame SOURCES/exiv2-CVE-2018-8976.patch

340e69
diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
340e69
index 9afcb58..ca83f14 100644
340e69
--- a/src/jpgimage.cpp
340e69
+++ b/src/jpgimage.cpp
340e69
@@ -34,6 +34,7 @@ EXIV2_RCSID("@(#) $Id$")
340e69
 #include "image_int.hpp"
340e69
 #include "error.hpp"
340e69
 #include "futils.hpp"
340e69
+#include "enforce.hpp"
340e69
 
340e69
 #ifdef WIN32
340e69
 #include <windows.h>
340e69
@@ -328,12 +329,14 @@ namespace Exiv2 {
340e69
         int c = -1;
340e69
         // Skips potential padding between markers
340e69
         while ((c=io_->getb()) != 0xff) {
340e69
-            if (c == EOF) return -1;
340e69
+            if (c == EOF)
340e69
+                return -1;
340e69
         }
340e69
 
340e69
         // Markers can start with any number of 0xff
340e69
         while ((c=io_->getb()) == 0xff) {
340e69
-            if (c == EOF) return -2;
340e69
+            if (c == EOF)
340e69
+                return -2;
340e69
         }
340e69
         return c;
340e69
     }
340e69
@@ -564,85 +567,88 @@ namespace Exiv2 {
340e69
      out << Internal::stringFormat("%8ld | 0xff%02x %-5s", \
340e69
                              io_->tell()-2,marker,nm[marker].c_str())
340e69
 
340e69
-    void JpegBase::printStructure(std::ostream& out, PrintStructureOption option,int depth)
340e69
+    void JpegBase::printStructure(std::ostream& out, PrintStructureOption option, int depth)
340e69
     {
340e69
-        if (io_->open() != 0) throw Error(9, io_->path(), strError());
340e69
+        if (io_->open() != 0)
340e69
+            throw Error(9, io_->path(), strError());
340e69
         // Ensure that this is the correct image type
340e69
         if (!isThisType(*io_, false)) {
340e69
-            if (io_->error() || io_->eof()) throw Error(14);
340e69
+            if (io_->error() || io_->eof())
340e69
+                throw Error(14);
340e69
             throw Error(15);
340e69
         }
340e69
 
340e69
-        bool bPrint = option==kpsBasic || option==kpsRecursive;
340e69
+        bool bPrint = option == kpsBasic || option == kpsRecursive;
340e69
         Exiv2::Uint32Vector iptcDataSegs;
340e69
 
340e69
-        if ( bPrint || option == kpsXMP || option == kpsIccProfile || option == kpsIptcErase ) {
340e69
+        if (bPrint || option == kpsXMP || option == kpsIccProfile || option == kpsIptcErase) {
340e69
 
340e69
             // nmonic for markers
340e69
-            std::string nm[256] ;
340e69
-            nm[0xd8]="SOI"  ;
340e69
-            nm[0xd9]="EOI"  ;
340e69
-            nm[0xda]="SOS"  ;
340e69
-            nm[0xdb]="DQT"  ;
340e69
-            nm[0xdd]="DRI"  ;
340e69
-            nm[0xfe]="COM"  ;
340e69
+            std::string nm[256];
340e69
+            nm[0xd8] = "SOI";
340e69
+            nm[0xd9] = "EOI";
340e69
+            nm[0xda] = "SOS";
340e69
+            nm[0xdb] = "DQT";
340e69
+            nm[0xdd] = "DRI";
340e69
+            nm[0xfe] = "COM";
340e69
 
340e69
             // 0xe0 .. 0xef are APPn
340e69
             // 0xc0 .. 0xcf are SOFn (except 4)
340e69
-            nm[0xc4]="DHT"  ;
340e69
-            for ( int i = 0 ; i <= 15 ; i++ ) {
340e69
+            nm[0xc4] = "DHT";
340e69
+            for (int i = 0; i <= 15; i++) {
340e69
                 char MN[10];
340e69
-                sprintf(MN,"APP%d",i);
340e69
-                nm[0xe0+i] = MN;
340e69
-                if ( i != 4 ) {
340e69
-                    sprintf(MN,"SOF%d",i);
340e69
-                    nm[0xc0+i] = MN;
340e69
+                sprintf(MN, "APP%d", i);
340e69
+                nm[0xe0 + i] = MN;
340e69
+                if (i != 4) {
340e69
+                    sprintf(MN, "SOF%d", i);
340e69
+                    nm[0xc0 + i] = MN;
340e69
                 }
340e69
             }
340e69
 
340e69
             // which markers have a length field?
340e69
             bool mHasLength[256];
340e69
-            for ( int i = 0 ; i < 256 ; i ++ )
340e69
-                mHasLength[i]
340e69
-                  =   ( i >= sof0_ && i <= sof15_)
340e69
-                  ||  ( i >= app0_ && i <= (app0_ | 0x0F))
340e69
-                  ||  ( i == dht_  || i == dqt_ || i == dri_ || i == com_ || i == sos_ )
340e69
-                  ;
340e69
+            for (int i = 0; i < 256; i++)
340e69
+                mHasLength[i] = (i >= sof0_ && i <= sof15_) || (i >= app0_ && i <= (app0_ | 0x0F)) ||
340e69
+                                (i == dht_ || i == dqt_ || i == dri_ || i == com_ || i == sos_);
340e69
 
340e69
             // Container for the signature
340e69
-            bool        bExtXMP    = false;
340e69
-            long        bufRead    =  0;
340e69
-            const long  bufMinSize = 36;
340e69
-            DataBuf     buf(bufMinSize);
340e69
+            bool bExtXMP = false;
340e69
+            long bufRead = 0;
340e69
+            const long bufMinSize = 36;
340e69
+            DataBuf buf(bufMinSize);
340e69
 
340e69
             // Read section marker
340e69
             int marker = advanceToMarker();
340e69
-            if (marker < 0) throw Error(15);
340e69
+            if (marker < 0)
340e69
+                throw Error(15);
340e69
 
340e69
-            bool    done = false;
340e69
-            bool    first= true;
340e69
+            bool done = false;
340e69
+            bool first = true;
340e69
             while (!done) {
340e69
                 // print marker bytes
340e69
-                if ( first && bPrint ) {
340e69
+                if (first && bPrint) {
340e69
                     out << "STRUCTURE OF JPEG FILE: " << io_->path() << std::endl;
340e69
-                    out << " address | marker       |  length | data" << std::endl ;
340e69
+                    out << " address | marker       |  length | data" << std::endl;
340e69
                     REPORT_MARKER;
340e69
                 }
340e69
-                first    = false;
340e69
+                first = false;
340e69
                 bool bLF = bPrint;
340e69
 
340e69
                 // Read size and signature
340e69
                 std::memset(buf.pData_, 0x0, buf.size_);
340e69
                 bufRead = io_->read(buf.pData_, bufMinSize);
340e69
-                if (io_->error()) throw Error(14);
340e69
-                if (bufRead < 2) throw Error(15);
340e69
-                uint16_t size = mHasLength[marker] ? getUShort(buf.pData_, bigEndian) : 0 ;
340e69
-                if ( bPrint &&  mHasLength[marker] ) out << Internal::stringFormat(" | %7d ", size);
340e69
+                if (io_->error())
340e69
+                    throw Error(14);
340e69
+                if (bufRead < 2)
340e69
+                    throw Error(15);
340e69
+                uint16_t size = mHasLength[marker] ? getUShort(buf.pData_, bigEndian) : 0;
340e69
+                if (bPrint && mHasLength[marker])
340e69
+                    out << Internal::stringFormat(" | %7d ", size);
340e69
 
340e69
                 // print signature for APPn
340e69
                 if (marker >= app0_ && marker <= (app0_ | 0x0F)) {
340e69
                     // http://www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3.pdf p75
340e69
-                    const char* signature = (const char*) buf.pData_+2;
340e69
+                    const char* signature = (const char*)buf.pData_ + 2;
340e69
 
340e69
                     // 728 rmills@rmillsmbp:~/gnu/exiv2/ttt $ exiv2 -pS test/data/exiv2-bug922.jpg
340e69
                     // STRUCTURE OF JPEG FILE: test/data/exiv2-bug922.jpg
340e69
@@ -651,13 +657,13 @@ namespace Exiv2 {
340e69
                     //       2 | 0xe1 APP1  |     911 | Exif..MM.*.......%.........#....
340e69
                     //     915 | 0xe1 APP1  |     870 | http://ns.adobe.com/xap/1.0/.
340e69
                     //    1787 | 0xe1 APP1  |   65460 | http://ns.adobe.com/xmp/extensio
340e69
-                    if ( option == kpsXMP && std::string(signature).find("http://ns.adobe.com/x")== 0 ) {
340e69
+                    if (option == kpsXMP && std::string(signature).find("http://ns.adobe.com/x") == 0) {
340e69
                         // extract XMP
340e69
-                        if ( size > 0 ) {
340e69
-                            io_->seek(-bufRead , BasicIo::cur);
340e69
-                            byte* xmp  = new byte[size+1];
340e69
-                            io_->read(xmp,size);
340e69
-                            int start = 0 ;
340e69
+                        if (size > 0) {
340e69
+                            io_->seek(-bufRead, BasicIo::cur);
340e69
+                            byte* xmp = new byte[size + 1];
340e69
+                            io_->read(xmp, size);
340e69
+                            int start = 0;
340e69
 
340e69
                             // http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3.pdf
340e69
                             // if we find HasExtendedXMP, set the flag and ignore this block
340e69
@@ -666,79 +672,80 @@ namespace Exiv2 {
340e69
                             // we could implement out of sequence with a dictionary of sequence/offset
340e69
                             // and dumping the XMP in a post read operation similar to kpsIptcErase
340e69
                             // for the moment, dumping 'on the fly' is working fine
340e69
-                            if ( ! bExtXMP ) {
340e69
-                                while (xmp[start]) start++;
340e69
+                            if (!bExtXMP) {
340e69
+                                while (xmp[start])
340e69
+                                    start++;
340e69
                                 start++;
340e69
-                                if ( ::strstr((char*)xmp+start,"HasExtendedXMP") ) {
340e69
-                                    start  = size ; // ignore this packet, we'll get on the next time around
340e69
+                                if (::strstr((char*)xmp + start, "HasExtendedXMP")) {
340e69
+                                    start = size;  // ignore this packet, we'll get on the next time around
340e69
                                     bExtXMP = true;
340e69
                                 }
340e69
                             } else {
340e69
-                                start = 2+35+32+4+4; // Adobe Spec, p19
340e69
+                                start = 2 + 35 + 32 + 4 + 4;  // Adobe Spec, p19
340e69
                             }
340e69
 
340e69
-                            out.write((const char*)(xmp+start),size-start);
340e69
-                            delete [] xmp;
340e69
+                            out.write((const char*)(xmp + start), size - start);
340e69
+                            delete[] xmp;
340e69
                             bufRead = size;
340e69
                             done = !bExtXMP;
340e69
                         }
340e69
-                    } else if ( option == kpsIccProfile && std::strcmp(signature,iccId_) == 0 ) {
340e69
+                    } else if (option == kpsIccProfile && std::strcmp(signature, iccId_) == 0) {
340e69
                         // extract ICCProfile
340e69
-                        if ( size > 0 ) {
340e69
-                            io_->seek(-bufRead, BasicIo::cur); // back to buffer (after marker)
340e69
-                            io_->seek(    14+2, BasicIo::cur); // step over header
340e69
-                            DataBuf   icc(size-(14+2));
340e69
-                            io_->read(             icc.pData_,icc.size_);
340e69
-                            out.write((const char*)icc.pData_,icc.size_);
340e69
+                        if (size > 0) {
340e69
+                            io_->seek(-bufRead, BasicIo::cur);  // back to buffer (after marker)
340e69
+                            io_->seek(14 + 2, BasicIo::cur);    // step over header
340e69
+                            DataBuf icc(size - (14 + 2));
340e69
+                            io_->read(icc.pData_, icc.size_);
340e69
+                            out.write((const char*)icc.pData_, icc.size_);
340e69
 #ifdef DEBUG
340e69
                             std::cout << "iccProfile size = " << icc.size_ << std::endl;
340e69
 #endif
340e69
                             bufRead = size;
340e69
                         }
340e69
-                    } else if ( option == kpsIptcErase && std::strcmp(signature,"Photoshop 3.0") == 0 ) {
340e69
+                    } else if (option == kpsIptcErase && std::strcmp(signature, "Photoshop 3.0") == 0) {
340e69
                         // delete IPTC data segment from JPEG
340e69
-                        if ( size > 0 ) {
340e69
-                            io_->seek(-bufRead , BasicIo::cur);
340e69
+                        if (size > 0) {
340e69
+                            io_->seek(-bufRead, BasicIo::cur);
340e69
                             iptcDataSegs.push_back(io_->tell());
340e69
                             iptcDataSegs.push_back(size);
340e69
                         }
340e69
-                    } else if ( bPrint ) {
340e69
-                        out << "| " << Internal::binaryToString(buf,size>32?32:size,size>0?2:0);
340e69
-                        if ( std::strcmp(signature,iccId_) == 0 ) {
340e69
-                            int chunk  = (int) signature[12];
340e69
-                            int chunks = (int) signature[13];
340e69
-                            out << Internal::stringFormat(" chunk %d/%d",chunk,chunks);
340e69
+                    } else if (bPrint) {
340e69
+                        out << "| " << Internal::binaryToString(buf, size > 32 ? 32 : size, size > 0 ? 2 : 0);
340e69
+                        if (std::strcmp(signature, iccId_) == 0) {
340e69
+                            int chunk = (int)signature[12];
340e69
+                            int chunks = (int)signature[13];
340e69
+                            out << Internal::stringFormat(" chunk %d/%d", chunk, chunks);
340e69
                         }
340e69
                     }
340e69
 
340e69
                     // for MPF: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/MPF.html
340e69
                     // for FLIR: http://owl.phy.queensu.ca/~phil/exiftool/TagNames/FLIR.html
340e69
-                    bool bFlir = option == kpsRecursive && marker == (app0_+1) && std::strcmp(signature,"FLIR")==0;
340e69
-                    bool bExif = option == kpsRecursive && marker == (app0_+1) && std::strcmp(signature,"Exif")==0;
340e69
-                    bool bMPF  = option == kpsRecursive && marker == (app0_+2) && std::strcmp(signature,"MPF")==0;
340e69
-                    bool bPS   = option == kpsRecursive                        && std::strcmp(signature,"Photoshop 3.0")==0;
340e69
-                    if( bFlir || bExif || bMPF || bPS ) {
340e69
+                    bool bFlir = option == kpsRecursive && marker == (app0_ + 1) && std::strcmp(signature, "FLIR") == 0;
340e69
+                    bool bExif = option == kpsRecursive && marker == (app0_ + 1) && std::strcmp(signature, "Exif") == 0;
340e69
+                    bool bMPF = option == kpsRecursive && marker == (app0_ + 2) && std::strcmp(signature, "MPF") == 0;
340e69
+                    bool bPS = option == kpsRecursive && std::strcmp(signature, "Photoshop 3.0") == 0;
340e69
+                    if (bFlir || bExif || bMPF || bPS) {
340e69
                         // extract Exif data block which is tiff formatted
340e69
-                        if ( size > 0 ) {
340e69
+                        if (size > 0) {
340e69
                             out << std::endl;
340e69
 
340e69
                             // allocate storage and current file position
340e69
-                            byte*    exif      = new byte[size];
340e69
-                            uint32_t restore   = io_->tell();
340e69
+                            byte* exif = new byte[size];
340e69
+                            uint32_t restore = io_->tell();
340e69
 
340e69
                             // copy the data to memory
340e69
-                            io_->seek(-bufRead , BasicIo::cur);
340e69
-                            io_->read(exif,size);
340e69
-                            uint32_t start     = std::strcmp(signature,"Exif")==0 ? 8 : 6;
340e69
-                            uint32_t max       = (uint32_t) size -1;
340e69
+                            io_->seek(-bufRead, BasicIo::cur);
340e69
+                            io_->read(exif, size);
340e69
+                            uint32_t start = std::strcmp(signature, "Exif") == 0 ? 8 : 6;
340e69
+                            uint32_t max = (uint32_t)size - 1;
340e69
 
340e69
                             // is this an fff block?
340e69
-                            if ( bFlir ) {
340e69
-                                start = 0 ;
340e69
+                            if (bFlir) {
340e69
+                                start = 0;
340e69
                                 bFlir = false;
340e69
-                                while ( start < max ) {
340e69
-                                    if ( std::strcmp((const char*)(exif+start),"FFF")==0 ) {
340e69
-                                        bFlir = true ;
340e69
+                                while (start < max) {
340e69
+                                    if (std::strcmp((const char*)(exif + start), "FFF") == 0) {
340e69
+                                        bFlir = true;
340e69
                                         break;
340e69
                                     }
340e69
                                     start++;
340e69
@@ -747,78 +754,90 @@ namespace Exiv2 {
340e69
 
340e69
                             // there is a header in FLIR, followed by a tiff block
340e69
                             // Hunt down the tiff using brute force
340e69
-                            if ( bFlir ) {
340e69
+                            if (bFlir) {
340e69
                                 // FLIRFILEHEAD* pFFF = (FLIRFILEHEAD*) (exif+start) ;
340e69
-                                while ( start < max ) {
340e69
-                                    if ( exif[start] == 'I' && exif[start+1] == 'I' ) break;
340e69
-                                    if ( exif[start] == 'M' && exif[start+1] == 'M' ) break;
340e69
+                                while (start < max) {
340e69
+                                    if (exif[start] == 'I' && exif[start + 1] == 'I')
340e69
+                                        break;
340e69
+                                    if (exif[start] == 'M' && exif[start + 1] == 'M')
340e69
+                                        break;
340e69
                                     start++;
340e69
                                 }
340e69
-                                if ( start < max ) std::cout << "  FFF start = " << start << std::endl ;
340e69
+                                if ( start < max )
340e69
+                                    std::cout << "  FFF start = " << start << std::endl;
340e69
                                 // << " index = " << pFFF->dwIndexOff << std::endl;
340e69
                             }
340e69
 
340e69
-                            if ( bPS ) {
340e69
-                                IptcData::printStructure(out,exif,size,depth);
340e69
+                            if (bPS) {
340e69
+                                IptcData::printStructure(out, exif, size, depth);
340e69
                             } else {
340e69
                                 // create a copy on write memio object with the data, then print the structure
340e69
-                                BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(exif+start,size-start));
340e69
-                                if ( start < max ) printTiffStructure(*p,out,option,depth);
340e69
+                                BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(exif + start, size - start));
340e69
+                                if (start < max)
340e69
+                                    printTiffStructure(*p, out, option, depth);
340e69
                             }
340e69
 
340e69
                             // restore and clean up
340e69
-                            io_->seek(restore,Exiv2::BasicIo::beg);
340e69
-                            delete [] exif;
340e69
-                            bLF    = false;
340e69
+                            io_->seek(restore, Exiv2::BasicIo::beg);
340e69
+                            delete[] exif;
340e69
+                            bLF = false;
340e69
                         }
340e69
                     }
340e69
                 }
340e69
 
340e69
                 // print COM marker
340e69
-                if ( bPrint && marker == com_ ) {
340e69
-                    int n = (size-2)>32?32:size-2; // size includes 2 for the two bytes for size!
340e69
-                    out << "| " << Internal::binaryToString(buf,n,2); // start after the two bytes
340e69
+                if (bPrint && marker == com_) {
340e69
+                    int n = (size - 2) > 32 ? 32 : size - 2;             // size includes 2 for the two bytes for size!
340e69
+                    out << "| " << Internal::binaryToString(buf, n, 2);  // start after the two bytes
340e69
                 }
340e69
 
340e69
                 // Skip the segment if the size is known
340e69
-                if (io_->seek(size - bufRead, BasicIo::cur)) throw Error(14);
340e69
+                if (io_->seek(size - bufRead, BasicIo::cur))
340e69
+                    throw Error(14);
340e69
 
340e69
-                if ( bLF ) out << std::endl;
340e69
+                if (bLF)
340e69
+                    out << std::endl;
340e69
 
340e69
                 if (marker != sos_) {
340e69
                     // Read the beginning of the next segment
340e69
                     marker = advanceToMarker();
340e69
+                    enforce(marker>=0, kerNoImageInInputData);
340e69
                     REPORT_MARKER;
340e69
                 }
340e69
                 done |= marker == eoi_ || marker == sos_;
340e69
-                if ( done && bPrint ) out << std::endl;
340e69
+                if (done && bPrint)
340e69
+                    out << std::endl;
340e69
             }
340e69
         }
340e69
-        if ( option == kpsIptcErase && iptcDataSegs.size() ) {
340e69
+        if (option == kpsIptcErase && iptcDataSegs.size()) {
340e69
 #ifdef DEBUG
340e69
             std::cout << "iptc data blocks: " << iptcDataSegs.size() << std::endl;
340e69
-            uint32_t toggle = 0 ;
340e69
-            for ( Uint32Vector_i i = iptcDataSegs.begin(); i != iptcDataSegs.end() ; i++ ) {
340e69
-                std::cout << *i ;
340e69
-                if ( toggle++ % 2 ) std::cout << std::endl; else std::cout << ' ' ;
340e69
+            uint32_t toggle = 0;
340e69
+            for (Uint32Vector_i i = iptcDataSegs.begin(); i != iptcDataSegs.end(); i++) {
340e69
+                std::cout << *i;
340e69
+                if (toggle++ % 2)
340e69
+                    std::cout << std::endl;
340e69
+                else
340e69
+                    std::cout << ' ';
340e69
             }
340e69
 #endif
340e69
-            uint32_t count  = (uint32_t) iptcDataSegs.size();
340e69
+            uint32_t count = (uint32_t)iptcDataSegs.size();
340e69
 
340e69
             // figure out which blocks to copy
340e69
-            uint64_t* pos = new uint64_t[count+2];
340e69
-            pos[0]        = 0 ;
340e69
+            uint64_t* pos = new uint64_t[count + 2];
340e69
+            pos[0] = 0;
340e69
             // copy the data that is not iptc
340e69
             Uint32Vector_i it = iptcDataSegs.begin();
340e69
-            for ( uint64_t  i = 0 ; i < count ; i++ ) {
340e69
-                bool  bOdd  = (i%2)!=0;
340e69
-                bool  bEven = !bOdd;
340e69
-                pos[i+1]    = bEven ? *it : pos[i] + *it;
340e69
+            for (uint64_t i = 0; i < count; i++) {
340e69
+                bool bOdd = (i % 2) != 0;
340e69
+                bool bEven = !bOdd;
340e69
+                pos[i + 1] = bEven ? *it : pos[i] + *it;
340e69
                 it++;
340e69
             }
340e69
-            pos[count+1] = io_->size() - pos[count];
340e69
+            pos[count + 1] = io_->size() - pos[count];
340e69
 #ifdef DEBUG
340e69
-            for ( uint64_t i = 0 ; i < count+2 ; i++ ) std::cout << pos[i] << " " ;
340e69
+            for (uint64_t i = 0; i < count + 2; i++)
340e69
+                std::cout << pos[i] << " ";
340e69
             std::cout << std::endl;
340e69
 #endif
340e69
             // $ dd bs=1 skip=$((0)) count=$((13164)) if=ETH0138028.jpg of=E1.jpg
340e69
@@ -829,29 +848,30 @@ namespace Exiv2 {
340e69
             // binary copy io_ to a temporary file
340e69
             BasicIo::AutoPtr tempIo(new MemIo);
340e69
 
340e69
-            assert (tempIo.get() != 0);
340e69
-            for ( uint64_t i = 0 ; i < (count/2)+1 ; i++ ) {
340e69
-                uint64_t start  = pos[2*i]+2 ; // step JPG 2 byte marker
340e69
-                if ( start == 2 ) start = 0  ; // read the file 2 byte SOI
340e69
-                long length = (long) (pos[2*i+1] - start) ;
340e69
-                if ( length ) {
340e69
+            assert(tempIo.get() != 0);
340e69
+            for (uint64_t i = 0; i < (count / 2) + 1; i++) {
340e69
+                uint64_t start = pos[2 * i] + 2;  // step JPG 2 byte marker
340e69
+                if (start == 2)
340e69
+                    start = 0;  // read the file 2 byte SOI
340e69
+                long length = (long)(pos[2 * i + 1] - start);
340e69
+                if (length) {
340e69
 #ifdef DEBUG
340e69
-                    std::cout << start <<":"<< length << std::endl;
340e69
+                    std::cout << start << ":" << length << std::endl;
340e69
 #endif
340e69
-                    io_->seek(start,BasicIo::beg);
340e69
+                    io_->seek(start, BasicIo::beg);
340e69
                     DataBuf buf(length);
340e69
-                    io_->read(buf.pData_,buf.size_);
340e69
-                    tempIo->write(buf.pData_,buf.size_);
340e69
+                    io_->read(buf.pData_, buf.size_);
340e69
+                    tempIo->write(buf.pData_, buf.size_);
340e69
                 }
340e69
             }
340e69
-            delete [] pos;
340e69
+            delete[] pos;
340e69
 
340e69
             io_->seek(0, BasicIo::beg);
340e69
-            io_->transfer(*tempIo); // may throw
340e69
+            io_->transfer(*tempIo);  // may throw
340e69
             io_->seek(0, BasicIo::beg);
340e69
             readMetadata();
340e69
         }
340e69
-    } // JpegBase::printStructure
340e69
+    }  // JpegBase::printStructure
340e69
 
340e69
     void JpegBase::writeMetadata()
340e69
     {