Package: flvtool2
Version: 1.0.6-3
Severity: normal
Tags: patch

Hi,

There is a bug in flv/stream.rb, at line 399, when testing for the
presence of audio in a FLV file. Given the following program, with
input.flv a valid FLV file containing audio tags:

% cat flv_stream_audio_flags.rb
#! /usr/bin/ruby
# -*- coding: utf-8 -*-

require 'flv'

File.open '/tmp/input.flv' do |in_stream|
  flv_stream = FLV::FLVStream.new in_stream

  p flv_stream.type_flags_audio
end
% ruby flv_stream_audio_flags.rb
false

The issue here is the test used in stream.rb:

@type_flags_audio = (type_flags & 4) == 1

Unfortunately, in ruby:

% irb
>> 4 & 4
=> 4

The attached patch should fix the problem.

Cheers,

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages flvtool2 depends on:
ii  ruby1.8                      1.8.7.249-2 Interpreter of object-oriented scr

flvtool2 recommends no packages.

flvtool2 suggests no packages.

-- no debconf information
--- /usr/lib/ruby/1.8/flv/stream.rb.orig        2010-04-23 23:26:37.000000000 
+0200
+++ /usr/lib/ruby/1.8/flv/stream.rb     2010-04-23 23:56:00.000000000 +0200
@@ -396,7 +396,7 @@
           log "File version: #...@version}"
           
           type_flags = @in_stream.read__UI8
-          @type_flags_audio = (type_flags & 4) == 1
+          @type_flags_audio = (type_flags & 4) == 4
           log "File has audio: #...@type_flags_audio}"
           
           @type_flags_video = (type_flags & 1) == 1

Reply via email to