Skip to content

Commit

Permalink
Fix out of bounds in stream detection
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong authored May 17, 2022
1 parent 9d9280b commit 9eae3a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/fplay.nim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ proc paramAndCodec(ctx: ptr AVFormatContext, vidcodec, audcodec: var CodecInfo):
streams = cast[ptr UncheckedArray[ptr AVStream]](ctx[].streams)
foundVideo = false
foundAudio = false
for i in 0 .. ctx[].nb_streams:
for i in 0 ..< ctx[].nb_streams:
let localparam = streams[i][].codecpar
if localparam[].codec_type == AVMEDIA_TYPE_VIDEO:
let rational = streams[i].avg_frame_rate
Expand Down Expand Up @@ -264,4 +264,4 @@ proc sample(ctx: ptr AVCodecContext, pkt: ptr AVPacket, frame: ptr AVFrame;
echo &"cannot queue audio: {getError()}"
return

main()
main()

0 comments on commit 9eae3a5

Please sign in to comment.