Mercurial > hg
view contrib/packaging/dockerrpm @ 38935:27a54096c92e
linelog: fix infinite loop vulnerability
Checking `len(lines)` is not a great way of detecting infinite loops, as
demonstrated in the added test. Therefore check instruction count instead.
The original C implementation does not have this problem. There are a few
other places where the C implementation enforces more strictly, like
`a1 <= a2`, `b1 <= b2`, `rev > 0`. But they are optional.
Test Plan:
Add a test. The old code forces the test to time out.
Differential Revision: https://phab.mercurial-scm.org/D4151
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 06 Aug 2018 22:24:00 -0700 |
parents | e5916f1236f3 |
children | 4c0d4bbdc395 |
line wrap: on
line source
#!/bin/bash -e BUILDDIR=$(dirname $0) export ROOTDIR=$(cd $BUILDDIR/../..; pwd) PLATFORM="$1" shift # extra params are passed to buildrpm DOCKER=$($BUILDDIR/hg-docker docker-path) CONTAINER=hg-docker-$PLATFORM $BUILDDIR/hg-docker build $BUILDDIR/docker/$PLATFORM $CONTAINER RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* DSHARED=/mnt/shared DBUILDUSER=build $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ createrepo $DSHARED cat << EOF > $RPMBUILDDIR/mercurial.repo # Place this file in /etc/yum.repos.d/mercurial.repo [mercurial] name=Mercurial packages for $PLATFORM # baseurl=file://$RPMBUILDDIR/ baseurl=http://hg.example.com/build/$PLATFORM/ skip_if_unavailable=True gpgcheck=0 enabled=1 EOF echo echo "Build complete - results can be found in $RPMBUILDDIR"