Author Topic: WMV/ASF plugin fixed crash when load large wmv  (Read 84 times)

zeas

  • Newbie
  • *
  • Posts: 2
WMV/ASF plugin fixed crash when load large wmv
« on: September 16, 2018, 06:15:28 AM »
Modified the original plugin to fix crash issue when load large wmv/asf files.
Replace all member/local variant refer to offset/filesize to uint64_t

Only win32 now, tested on 2.7.1


The patch above based on official 2.7.1 released source code.

=====================================
ADM_asf.h
82c82
<   uint32_t  _chunkStart;
---
>   uint64_t  _chunkStart;
132c132
<     uint32_t                _dataStart;
---
>     uint64_t                _dataStart;
199c199
<     uint32_t                _dataStartOffset;
---
>     uint64_t                _dataStartOffset;

=====================================
ADM_asfPacket.h
51c51
<     uint8_t         skip( uint32_t how);
---
>     uint8_t         skip( uint64_t how);
53,55c53,55
<     uint32_t        packetStart;
<     uint8_t         segmentId;
<     uint32_t        pakSize;
---
>       uint8_t         segmentId;
>       uint64_t        packetStart;
>     uint64_t        pakSize;
58c58,59
<     uint32_t        _offset;
---
>     uint64_t        _offset;
>     uint64_t        _startDataOffset;
60d60
<     uint32_t        _startDataOffset;

=====================================
ADM_asfPacket.cpp
81c81
<    uint32_t offset=_startDataOffset+packet*pakSize;
---
>    uint64_t offset=_startDataOffset+packet*pakSize;
101c101
<         pts=read32()*1000; // PTS
---
>         pts=(uint64_t)read32()*1000; // PTS
183c183
<    dts=1000*read32(); // Send time (ms)
---
>    dts=1000*(uint64_t)read32(); // Send time (ms)
194c194
<    uint32_t payloadLen;
---
>    uint32_t payloadLen = 0;
369c369
<    uint32_t go;
---
>    uint64_t go;
398c398
<  uint8_t   asfPacket::skip( uint32_t how)
---
>  uint8_t   asfPacket::skip( uint64_t how)

=====================================
ADM_asfHeaders.cpp
415c415
<   uint32_t fSize;
---
>   uint64_t fSize;


eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2136
Re: WMV/ASF plugin fixed crash when load large wmv
« Reply #1 on: September 17, 2018, 07:23:27 AM »
Modified the original plugin to fix crash issue when load large wmv/asf files.

Thanks, I'll try to look into it later. How large were the wmv/asf files to trigger the problem? Did you really encounter WMV > 4 GiB in size?

zeas

  • Newbie
  • *
  • Posts: 2
Re: WMV/ASF plugin fixed crash when load large wmv
« Reply #2 on: September 17, 2018, 03:32:28 PM »
Thanks, I'll try to look into it later. How large were the wmv/asf files to trigger the problem? Did you really encounter WMV > 4 GiB in size?

Yes. And WMV > 2GB may cause crash in previous version (<2.6)
By the way, some large WMV < 4GB may not cause crash but cannot seek frames after a time point, due to pts = read32() * 1000 larger than 0xFFFFFFFF and be truncated.