Fix few uninitialized variables and a stack smash in AVI dumper

- Fix uninitialized closed flag in avi_worker
- Fix uninitialized stream parameters in avi_writer
- Fix stack smash in AVI write_pkt (the padding is only 2 bytes, don't
  write an u32 into it!)
This commit is contained in:
Ilari Liusvaara 2017-05-29 17:32:09 +03:00
parent 7be5215c08
commit dd18168993
3 changed files with 3 additions and 1 deletions

View file

@ -187,6 +187,7 @@ namespace
ivcodec = info.vcodec;
segframes = 0;
max_segframes = info.max_frames;
closed = false;
fire();
}

View file

@ -56,7 +56,7 @@ namespace
char buf[8 + PADGRANULARITY];
serialization::u32l(buf + 0, fulltype);
serialization::u32l(buf + 4, pkt.payload.size());
serialization::u32l(buf + 8, 0);
serialization::u16l(buf + 8, 0);
size_t padding = (PADGRANULARITY - pkt.payload.size() % PADGRANULARITY) % PADGRANULARITY;
avifile.outstream->write(buf, 8);
avifile.outstream->write(&pkt.payload[0], pkt.payload.size());

View file

@ -97,4 +97,5 @@ avi_writer::avi_writer(const std::string& _prefix, struct avi_video_codec& _vcod
next_segment = 0;
samplerate = _samplerate;
channels = _audiochannels;
curwidth = curheight = curfps_n = curfps_d = 0;
}