Skip to content

Commit

Permalink
Fix #848, crash at HTTP fast buffer grow 2.0.239
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Apr 18, 2017
1 parent 33a0abd commit 5e284b5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ Remark:

## History

* v2.0, 2017-04-18, Fix [#848][bug #848], crash at HTTP fast buffer grow 2.0.239
* v2.0, 2017-04-15, Fix [#844][bug #844], support Haivision encoder. 2.0.238
* v2.0, 2017-04-15, Merge [#846][bug #846], fix fd leak for FLV stream caster. 2.0.237
* v2.0, 2017-04-15, Merge [#841][bug #841], avoid the duplicated sps/pps in ts. 2.0.236
Expand Down Expand Up @@ -1287,6 +1288,7 @@ Winlin
[bug #841]: https://github.com/ossrs/srs/issues/841
[bug #846]: https://github.com/ossrs/srs/issues/846
[bug #844]: https://github.com/ossrs/srs/issues/844
[bug #848]: https://github.com/ossrs/srs/issues/848
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx

[exo #828]: https://github.com/google/ExoPlayer/pull/828
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 238
#define VERSION_REVISION 239

// generated by configure, only macros.
#include <srs_auto_headers.hpp>
Expand Down
5 changes: 3 additions & 2 deletions trunk/src/protocol/srs_protocol_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ int SrsFastBuffer::grow(ISrsBufferReader* reader, int required_size)
// reset when buffer is empty.
p = end = buffer;
srs_verbose("all consumed, reset fast buffer");
} else {
} else if (nb_exists_bytes < nb_buffer && p > buffer) {
// move the left bytes to start of buffer.
srs_assert(nb_exists_bytes < nb_buffer);
// @remark Only move memory when space is enough, or failed at next check.
// @see https://github.com/ossrs/srs/issues/848
buffer = (char*)memmove(buffer, p, nb_exists_bytes);
p = buffer;
end = p + nb_exists_bytes;
Expand Down

0 comments on commit 5e284b5

Please sign in to comment.