Fix possible SIGFPE

This commit is contained in:
Tatsuhiro Tsujikawa 2014-04-27 14:40:10 +09:00
parent a82b7f09c8
commit cc7929bdcc
1 changed files with 4 additions and 0 deletions

View File

@ -146,6 +146,10 @@ int32_t nghttp2_stream_dep_distributed_weight(nghttp2_stream *stream,
int32_t nghttp2_stream_dep_distributed_effective_weight int32_t nghttp2_stream_dep_distributed_effective_weight
(nghttp2_stream *stream, int32_t 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; weight = stream->effective_weight * weight / stream->sum_norest_weight;
return nghttp2_max(1, weight); return nghttp2_max(1, weight);