Project

General

Profile

Bug #1038 » patch-exiv2-0.24-fix-mp4.diff

Anonymous, 08 Mar 2015 22:58

View differences:

exiv2-0.24/src/basicio.cpp
1145 1145
        case BasicIo::end: newIdx = p_->size_ + offset; break;
1146 1146
        }
1147 1147

  
1148
        if ( /*newIdx < 0 || */ newIdx > static_cast<uint64_t>(p_->size_) ) return 1;
1149 1148
        p_->idx_ = static_cast<long>(newIdx);   //not very sure about this. need more test!!    - note by Shawn  fly2xj@gmail.com //TODO
1150 1149
        p_->eof_ = false;
1151 1150
        return 0;
......
1161 1160
        case BasicIo::end: newIdx = p_->size_ + offset; break;
1162 1161
        }
1163 1162

  
1164
        if (newIdx < 0 || newIdx > p_->size_) return 1;
1163
        if (newIdx < 0) return 1;
1165 1164
        p_->idx_ = newIdx;
1166 1165
        p_->eof_ = false;
1167 1166
        return 0;
......
1215 1214

  
1216 1215
    long MemIo::read(byte* buf, long rcount)
1217 1216
    {
1218
        long avail = p_->size_ - p_->idx_;
1217
        long avail = EXV_MAX(p_->size_ - p_->idx_, 0);
1219 1218
        long allow = EXV_MIN(rcount, avail);
1220 1219
        std::memcpy(buf, &p_->data_[p_->idx_], allow);
1221 1220
        p_->idx_ += allow;
exiv2-0.24/src/quicktimevideo.cpp
1456 1456
                else if (currentStream_ == Audio)
1457 1457
                    xmpData_["Xmp.audio.MediaTimeScale"] = returnBufValue(buf);
1458 1458
                time_scale = returnBufValue(buf);
1459
                if (time_scale <= 0)
1460
                    time_scale = 1;
1459 1461
                break;
1460 1462
            case MediaDuration:
1461 1463
                if(currentStream_ == Video)
......
1571 1573
                xmpData_["Xmp.video.ModificationDate"] = returnUnsignedBufValue(buf); break;
1572 1574
            case TimeScale:
1573 1575
                xmpData_["Xmp.video.TimeScale"] = returnBufValue(buf);
1574
                timeScale_ = returnBufValue(buf); break;
1576
                timeScale_ = returnBufValue(buf);
1577
                if (timeScale_ <= 0) timeScale_ = 1;
1578
                break;
1575 1579
            case Duration:
1576 1580
                xmpData_["Xmp.video.Duration"] = returnBufValue(buf) * 1000 / timeScale_; break;
1577 1581
            case PreferredRate:
exiv2-0.24/src/quicktimevideo.hpp
223 223

  
224 224
    private:
225 225
        //! Variable which stores Time Scale unit, used to calculate time.
226
        uint64_t timeScale_;
226
        uint64_t timeScale_ = 1;
227 227
        //! Variable which stores current stream being processsed.
228 228
        int currentStream_;
229 229
        //! Variable to check the end of metadata traversing.
(1-1/3)