From cc7929bdcc24e802254eb31c9c4c98192c6fbe65 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 27 Apr 2014 14:40:10 +0900 Subject: [PATCH] Fix possible SIGFPE --- lib/nghttp2_stream.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/nghttp2_stream.c b/lib/nghttp2_stream.c index ac67bee1..aa36694c 100644 --- a/lib/nghttp2_stream.c +++ b/lib/nghttp2_stream.c @@ -146,6 +146,10 @@ int32_t nghttp2_stream_dep_distributed_weight(nghttp2_stream *stream, int32_t nghttp2_stream_dep_distributed_effective_weight (nghttp2_stream *stream, int32_t weight) { + if(stream->sum_norest_weight == 0) { + return stream->effective_weight; + } + weight = stream->effective_weight * weight / stream->sum_norest_weight; return nghttp2_max(1, weight);