From 37be18afca6c7cb5079ca58223e73bd3d4abbee1 Mon Sep 17 00:00:00 2001 From: nareix Date: Tue, 16 Aug 2016 15:33:22 +0800 Subject: [PATCH] av: AudioFrame split range check --- av/av.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/av/av.go b/av/av.go index 5fe1d0b..76b1f61 100644 --- a/av/av.go +++ b/av/av.go @@ -264,6 +264,9 @@ func (self AudioFrame) HasSameFormat(other AudioFrame) bool { // Split sample audio sample from this frame. func (self AudioFrame) Slice(start int, end int) (out AudioFrame) { + if start > end { + panic(fmt.Sprintf("av: AudioFrame split failed start=%d end=%d invalid", start, end)) + } out = self out.Data = append([][]byte(nil), out.Data...) out.SampleCount = end - start