Commit 5be06e74 authored by Jon Kåre Hellan's avatar Jon Kåre Hellan

Don't call init_stats from display_stats. Fixes use after free panic.

Debian package version 0.4-5
parent f4061916
qstream (0.4-5) unstable; urgency=low
* Don't call init_stats from display_stats. Fixes use after free panic.
svn version r35.
-- Jon K Hellan <jon.kare.hellan@uninett.no> Wed, 04 Jul 2012 09:18:29 +0200
qstream (0.4-4) unstable; urgency=low qstream (0.4-4) unstable; urgency=low
* Groups to poll taken from /etc/qstream/mpeg/poll.lst. svn version r33. * Groups to poll taken from /etc/qstream/mpeg/poll.lst. svn version r33.
......
...@@ -158,8 +158,14 @@ $SIG{INT} = sub { $uninterrupted=0; # return if $nint++ < 1; ...@@ -158,8 +158,14 @@ $SIG{INT} = sub { $uninterrupted=0; # return if $nint++ < 1;
&handle_threads() if ($opt_tcp and $opt_rtmp); &handle_threads() if ($opt_tcp and $opt_rtmp);
die "End after interrupt.\n";exit(0) }; die "End after interrupt.\n";exit(0) };
$SIG{KILL} = sub { $uninterrupted=0; # return if $nkill++ < 1;
&display_stats(); die "End after kill.\n";exit(0) }; $SIG{TERM} = sub { $uninterrupted=0; # return if $nkill++ < 1;
&display_stats();
&end_xml() if $opt_xml;
&handle_threads() if ($opt_tcp and $opt_rtmp);
die "End after sigterm.\n";exit(0) };
$SIG{ALRM} = sub { $SIG{ALRM} = sub {
# Writes stats to file if option XML is given. -PMM # Writes stats to file if option XML is given. -PMM
# die "No packets received" if $n_packets < 1; # die "No packets received" if $n_packets < 1;
...@@ -990,7 +996,7 @@ sub format_numbers{ ...@@ -990,7 +996,7 @@ sub format_numbers{
} }
} }
sub xml_dump_rtmp_tcp { sub xml_dump_rtmp_tcp {
my $f = shift; my $f = $_[0]; # *Not* shift. This gets called from a signal handler.
return 0 if $xml_printed; return 0 if $xml_printed;
my ($rtmp_jitter_stats,$rtmp_stats,$span) = get_rtmp_data() if $opt_rtmp; my ($rtmp_jitter_stats,$rtmp_stats,$span) = get_rtmp_data() if $opt_rtmp;
my ($tcp_packet_stats) = (\%tcp_packet_stats) if $opt_tcp; my ($tcp_packet_stats) = (\%tcp_packet_stats) if $opt_tcp;
...@@ -1150,7 +1156,7 @@ sub xml_new { ...@@ -1150,7 +1156,7 @@ sub xml_new {
sub xml_dump { sub xml_dump {
my $f = shift; my $f = $_[0]; # *Not* shift. This gets called from a signal handler.
return 0 if $xml_printed; return 0 if $xml_printed;
my ($network_info) = (\%network_info); my ($network_info) = (\%network_info);
my ($pcr_stats,$pts_stats) = (\%pcr_stats, \%pts_stats) if $opt_mpeg; my ($pcr_stats,$pts_stats) = (\%pcr_stats, \%pts_stats) if $opt_mpeg;
...@@ -1736,7 +1742,7 @@ sub display_stats{ ...@@ -1736,7 +1742,7 @@ sub display_stats{
sub print_out { sub print_out {
return 0 if $opt_rtmp; return 0 if $opt_rtmp;
my $f = shift; my $f = $_[0]; # *Not* shift. This gets called from a signal handler.
my $source=$f; my $source=$f;
my ($pts_stats) = (\%pts_stats); my ($pts_stats) = (\%pts_stats);
$source=$source{$f} if ! $opt_v && $source{$f} ne ""; $source=$source{$f} if ! $opt_v && $source{$f} ne "";
...@@ -2065,7 +2071,6 @@ sub print_out { ...@@ -2065,7 +2071,6 @@ sub print_out {
$opt_nohead=1; $opt_nohead=1;
$pdate=$date; $pdate=$date;
$flow_pkts{$f}=0; $flow_pkts{$f}=0;
&init_stats($f);
} }
sub display_bins{ sub display_bins{
print "\n\nBins "; print "\n\nBins ";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment