Mercurial > hg > ngx_http_bytes_filter_module
comparison ngx_http_bytes_filter_module.c @ 21:180d415c0e59
Avoid switching to a range past the last one.
Found with AddressSanitizer.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 17 Feb 2017 23:09:50 +0300 |
parents | 57365655ee44 |
children | 801de8ae9c0b |
comparison
equal
deleted
inserted
replaced
20:b676808a49bc | 21:180d415c0e59 |
---|---|
541 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 541 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
542 "bytes body filter: in memory fixed, %p-%p", | 542 "bytes body filter: in memory fixed, %p-%p", |
543 b->pos, b->last); | 543 b->pos, b->last); |
544 } | 544 } |
545 | 545 |
546 if (range->end < ctx->offset + size) { | 546 if (range->end < ctx->offset + size |
547 && range < last - 1) | |
548 { | |
547 range++; | 549 range++; |
548 if (range < last) { | 550 ctx->range = range; |
549 ctx->range = range; | 551 |
550 | 552 if (range->start > ctx->offset + size) { |
551 if (range->start > ctx->offset + size) { | 553 continue; |
552 continue; | 554 } |
553 } | 555 |
554 | 556 /* next range in same buffer */ |
555 /* next range in same buffer */ | 557 goto next; |
556 goto next; | |
557 } | |
558 } | 558 } |
559 } | 559 } |
560 | 560 |
561 return ngx_http_next_body_filter(r, out); | 561 return ngx_http_next_body_filter(r, out); |
562 } | 562 } |