Esempio n. 1
0
class X264(VProject):
    """Video encoder x264 (fetched by Git)"""

    NAME = 'x264'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.CODEC

    SOURCE = [
        block_revisions([
            GoodBadSubgraph(["5dc0aae2f900064d1f58579929a2285ab289a436"],
                            ["6490f4398d9e28e65d7517849e729e14eede8c5b"],
                            "Does not build on x64 out of the box")
        ])(PaperConfigSpecificGit(
            project_name="x264",
            remote="https://code.videolan.org/videolan/x264.git",
            local="x264",
            refspec="origin/HEAD",
            limit=None,
            shallow=False))
    ]

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(X264.NAME))

        binary_map.specify_binary("x264", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        x264_version_source = local.path(self.source_of_primary)
        x264_version = ShortCommitHash(self.version_of_primary)

        fpic_revisions = get_all_revisions_between(
            "5dc0aae2f900064d1f58579929a2285ab289a436",
            "290de9638e5364c37316010ac648a6c959f6dd26", ShortCommitHash,
            x264_version_source)
        ldflags_revisions = get_all_revisions_between(
            "6490f4398d9e28e65d7517849e729e14eede8c5b",
            "275ef5332dffec445a0c5a78dbc00c3e0766011d", ShortCommitHash,
            x264_version_source)

        if x264_version in fpic_revisions:
            self.cflags += ["-fPIC"]

        clang = bb.compiler.cc(self)
        with local.cwd(x264_version_source):
            with local.env(CC=str(clang)):
                configure_flags = ["--disable-asm"]
                if x264_version in ldflags_revisions:
                    configure_flags.append("--extra-ldflags=\"-static\"")
                bb.watch(local["./configure"])(configure_flags)
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)
Esempio n. 2
0
class Bison(VProject):
    """
    GNU Bison parser generator.

    (fetched by Git)
    """

    NAME = 'bison'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.PARSER

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="bison",
            remote="https://github.com/bincrafters/bison.git",
            local="bison",
            refspec="origin/HEAD",
            limit=None,
            shallow=False),
        bb.source.GitSubmodule(
            remote="https://github.com/coreutils/gnulib.git",
            local="bison/gnulib",
            refspec="origin/HEAD",
            limit=None,
            shallow=False,
            version_filter=project_filter_generator("bison"))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autopoint', 'flex',
        'gettext', 'graphviz', 'help2man', 'perl', 'rsync', 'texinfo', 'wget')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Bison.NAME))

        binary_map.specify_binary('./src/bison', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        bison_source = local.path(self.source_of(self.primary_source))

        c_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)
        with local.cwd(bison_source):
            bb.watch(git)("submodule", "update", "--init")

            with local.env(CC=str(c_compiler), CXX=str(cxx_compiler)):
                bb.watch(local["./bootstrap"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)
Esempio n. 3
0
class Libzmq(VProject):
    """The ZeroMQ lightweight messaging kernel is a library which extends the
    standard socket interfaces with features traditionally provided by
    specialised messaging middleware products."""

    NAME = 'libzmq'
    GROUP = 'cpp_projects'
    DOMAIN = ProjectDomains.C_LIBRARY

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libzmq",
            remote="https://github.com/zeromq/libzmq.git",
            local="libzmq_git",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake', 'build-essential', 'gnutls-dev',
        'libsodium-dev', 'pkg-config'
    )

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Libzmq.NAME))

        binary_map.specify_binary(
            "build/lib/libzmq.so", BinaryType.SHARED_LIBRARY
        )

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libzmq_version_source = local.path(self.source_of_primary)

        cpp_compiler = bb.compiler.cxx(self)
        mkdir(libzmq_version_source / "build")
        with local.cwd(libzmq_version_source / "build"):
            with local.env(CXX=str(cpp_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", "..")

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(libzmq_version_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Zeromq", "Libzmq")]
Esempio n. 4
0
class Grep(VProject):
    """GNU Grep / UNIX command-line tools (fetched by Git)"""

    NAME = 'grep'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="grep",
                               remote="https://github.com/vulder/grep.git",
                               local="grep",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False),
        bb.source.GitSubmodule(
            remote="https://github.com/coreutils/gnulib.git",
            local="grep/gnulib",
            refspec="origin/HEAD",
            limit=None,
            shallow=False,
            version_filter=project_filter_generator("grep"))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'autopoint', 'wget', 'gettext',
        'texinfo', 'rsync', 'automake', 'autotools-dev', 'pkg-config', 'gperf')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Grep.NAME))

        binary_map.specify_binary("src/grep", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        grep_source = local.path(self.source_of_primary)
        with local.cwd(grep_source):
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()), "check")

    def compile(self) -> None:
        grep_source = local.path(self.source_of_primary)
        compiler = bb.compiler.cc(self)
        with local.cwd(grep_source):
            with local.env(CC=str(compiler)):
                bb.watch(local["./bootstrap"])()
                bb.watch(local["./configure"])("--disable-gcc-warnings")

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("gnu", "grep")]
Esempio n. 5
0
class Doxygen(VProject):
    """Doxygen."""

    NAME = 'doxygen'
    GROUP = 'cpp_projects'
    DOMAIN = ProjectDomains.DOCUMENTATION

    SOURCE = [
        block_revisions([
            # TODO: se-sic/VaRA#536
            GoodBadSubgraph(["a6238a4898e20422fe6ef03fce4891c5749b1553"],
                            ["cf936efb8ae99dd297b6afb9c6a06beb81f5b0fb"],
                            "Needs flex <= 2.5.4 and >= 2.5.33"),
            GoodBadSubgraph(["093381b3fc6cc1e97f0e737feca04ebd0cfe538d"],
                            ["cf936efb8ae99dd297b6afb9c6a06beb81f5b0fb"],
                            "Needs flex <= 2.5.4 and >= 2.5.33")
        ])(PaperConfigSpecificGit(
            project_name="doxygen",
            remote="https://github.com/doxygen/doxygen.git",
            local="doxygen",
            refspec="origin/HEAD",
            limit=None,
            shallow=False))
    ]

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            Doxygen.NAME))

        binary_map.specify_binary('doxygen', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        doxygen_source = local.path(self.source_of_primary)

        clangxx = bb.compiler.cxx(self)
        with local.cwd(doxygen_source):
            with local.env(CXX=str(clangxx)):
                delete("CMakeCache.txt")
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            bb.watch(cp)("bin/doxygen", ".")

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("doxygen", "doxygen")]
Esempio n. 6
0
class Poppler(VProject):
    """Poppler is a free software utility library for rendering Portable
    Document Format documents."""

    NAME = 'poppler'
    GROUP = 'cpp_projects'
    DOMAIN = ProjectDomains.RENDERING

    SOURCE = [
        block_revisions([
            RevisionRange("e225b4b804881de02a5d1beb3f3f908a8f8ddc3d",
                          "2b2808719d2c91283ae358381391bb0b37d9061d",
                          "requiers QT6 which is not easily available")
        ])(PaperConfigSpecificGit(
            project_name="poppler",
            remote="https://gitlab.freedesktop.org/poppler/poppler.git",
            local="poppler",
            refspec="origin/HEAD",
            limit=None,
            shallow=False))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake', 'libfreetype6-dev',
        'libfontconfig-dev', 'libjpeg-dev', 'qt5-default', 'libopenjp2-7-dev')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            Poppler.NAME))

        binary_map.specify_binary("libpoppler.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        poppler_version_source = local.path(self.source_of(
            self.primary_source))

        c_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)
        with local.cwd(poppler_version_source):
            with local.env(CC=str(c_compiler), CXX=str(cxx_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Poppler", "Poppler")]
Esempio n. 7
0
class Curl(VProject):
    """
    Curl is a command-line tool for transferring data specified with URL syntax.

    (fetched by Git)
    """

    NAME = 'curl'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.WEB_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="curl",
            remote="https://github.com/curl/curl.git",
            local="curl",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    CONTAINER = get_base_image(
        ImageBase.DEBIAN_10
    ).run('apt', 'install', '-y', 'autoconf', 'automake', 'libtool', 'openssl')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Curl.NAME))

        binary_map.specify_binary('src/.libs/curl', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        curl_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(curl_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./buildconf"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Haxx", "Curl")]
Esempio n. 8
0
class Glib(VProject):
    """
    GLib is the low-level core library that forms the basis for projects such as
    GTK and GNOME. It provides data structure handling for C, portability
    wrappers, and interfaces for such runtime functionality as an event loop,
    threads, dynamic loading, and an object system.

    (fetched by Git)
    """

    NAME = 'glib'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.DATA_STRUCTURES

    SOURCE = [
        PaperConfigSpecificGit(project_name="glib",
                               remote="https://github.com/GNOME/glib.git",
                               local="glib",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'meson', 'ninja-build')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Glib.NAME))

        binary_map.specify_binary('build/glib/libglib-2.0.so',
                                  BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        glib_source = local.path(self.source_of_primary)

        cc_compiler = bb.compiler.cc(self)
        with local.cwd(glib_source):
            with local.env(CC=str(cc_compiler)):
                bb.watch(meson)("build")

            bb.watch(ninja)("-j", get_number_of_jobs(bb_cfg()), "-C", "build")

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Gnome", "Glib")]
Esempio n. 9
0
class Libsigrok(VProject):
    """
    The sigrok project aims at creating a portable, cross-platform,
    Free/Libre/Open-Source signal analysis software suite.

    (fetched by Git)
    """

    NAME = 'libsigrok'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.SIGNAL_PROCESSING

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libsigrok",
            remote="https://github.com/sigrokproject/libsigrok.git",
            local="libsigrok",
            refspec="origin/HEAD",
            limit=None,
            shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autotools-dev',
        'libtool', 'pkg-config', 'libzip-dev', 'libglib2.0-dev')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(
            get_local_project_git_path(Libsigrok.NAME))

        binary_map.specify_binary('.libs/libsigrok.so',
                                  BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        sigrok_source = local.path(self.source_of_primary)

        cc_compiler = bb.compiler.cc(self)
        with local.cwd(sigrok_source):
            with local.env(CC=str(cc_compiler)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)
Esempio n. 10
0
class Libxml2(VProject):
    """libxml2 is a software library for parsing XML documents."""

    NAME = 'libxml2'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.FILE_FORMAT

    SOURCE = [
        PaperConfigSpecificGit(project_name="libxml2",
                               remote="https://github.com/GNOME/libxml2.git",
                               local="libxml2",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10)\
        .run('apt', 'install', '-y', 'wget', 'liblzma-dev')\
        .run('/bin/bash', '-c',
             'wget -qO- '
             '\"https://cmake.org/files/v3.20'
             '/cmake-3.20.0-linux-x86_64.tar.gz\" '
             '| tar --strip-components=1 -xz -C /usr/local')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            Libxml2.NAME))

        binary_map.specify_binary("libxml2.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libxml2_version_source = local.path(self.source_of(
            self.primary_source))

        c_compiler = bb.compiler.cc(self)
        with local.cwd(libxml2_version_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Xmlsoft", "Libxml2")]
Esempio n. 11
0
class Redis(VProject):
    """
    Redis is an in-memory database that persists on disk.

    (fetched by Git)
    """

    NAME = 'redis'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.DATABASE

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="redis",
            remote="https://github.com/antirez/redis.git",
            local="redis",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Redis.NAME))

        binary_map.specify_binary(
            'src/redis-server',
            BinaryType.EXECUTABLE,
            override_binary_name='redis_server'
        )

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        redis_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(redis_source):
            with local.env(CC=str(clang)):
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Redislabs", "Redis")]
Esempio n. 12
0
class Irssi(VProject):
    """
    Irssi is a modular chat client that is most commonly known for its text mode
    user interface.

    (fetched by Git)
    """

    NAME = 'irssi'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.CHAT_CLIENT

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="irssi",
            remote="https://github.com/irssi/irssi.git",
            local="irssi",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Irssi.NAME))

        binary_map.specify_binary('./src/fe-text/irssi', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        irssi_source = local.path(self.source_of(self.primary_source))

        compiler = bb.compiler.cc(self)
        with local.cwd(irssi_source):
            with local.env(CC=str(compiler)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Irssi", "Irssi")]
Esempio n. 13
0
class MongoDB(VProject):
    """
    MongoDB is a cross-platform document-oriented database program.

    Classified as a NoSQL database program, MongoDB uses JSON-like documents
    with optional schemas.
    """

    NAME = 'mongodb'
    GROUP = 'cpp_projects'
    DOMAIN = ProjectDomains.DATABASE

    SOURCE = [
        PaperConfigSpecificGit(project_name="mongodb",
                               remote="https://github.com/mongodb/mongo.git",
                               local="mongodb",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            MongoDB.NAME))

        # TODO: please add correct binary names
        binary_map.specify_binary("MISSING", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        mongodb_version_source = local.path(self.source_of(
            self.primary_source))

        c_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)
        with local.cwd(mongodb_version_source):
            with local.env(CC=str(c_compiler), CXX=str(cxx_compiler)):
                bb.watch(python3)("buildscripts/scons.py",
                                  f"-j {get_number_of_jobs(bb_cfg())}", "-d",
                                  "--disable-warnings-as-errors")

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Mongodb", "Mongodb")]
Esempio n. 14
0
class Gawk(VProject):
    """
    GNU awk.

    (fetched by Git)
    """

    NAME = 'gawk'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="gawk",
            remote="https://github.com/vulder/gawk.git",
            local="gawk",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'libtool', 'perl', 'm4',
        'autopoint', 'gettext', 'bison'
    )

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Gawk.NAME))

        binary_map.specify_binary('gawk', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        gawk_source = local.path(self.source_of(self.primary_source))

        compiler = bb.compiler.cc(self)
        with local.cwd(gawk_source):
            with local.env(CC=str(compiler)):
                bb.watch(local["autoreconf"])("-if")
                bb.watch(local["./configure"])()

            bb.watch(make)("MAKEINFO=true", "-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)
Esempio n. 15
0
class Lrzip(VProject):
    """Compression and decompression tool lrzip (fetched by Git)"""

    NAME = 'lrzip'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        PaperConfigSpecificGit(project_name="lrzip",
                               remote="https://github.com/ckolivas/lrzip.git",
                               local="lrzip",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'tar', 'libz-dev', 'autoconf', 'libbz2-dev',
        'liblzo2-dev', 'liblz4-dev', 'coreutils', 'libtool')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Lrzip.NAME))

        binary_map.specify_binary("lrzip", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        lrzip_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        cc_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)

        with local.cwd(lrzip_source):
            with local.env(CC=str(cc_compiler), CXX=str(cxx_compiler)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("lrzip_project", "lrzip")]
Esempio n. 16
0
class File(VProject):
    """File command for recognizing the type of data contained in a file."""

    NAME = 'file'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="file",
                               remote="https://github.com/file/file",
                               local="file_git",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autotools-dev',
        'build-essential')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(File.NAME))

        binary_map.specify_binary("src/.libs/file", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        file_version_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        c_compiler = bb.compiler.cc(self)
        with local.cwd(file_version_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(autoreconf["-f", "-i"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(file_version_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("File Project", "file")]
Esempio n. 17
0
class Opus(VProject):
    """Opus is a codec for interactive speech and audio transmission over the
    Internet."""

    NAME = 'opus'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.CODEC

    SOURCE = [
        PaperConfigSpecificGit(project_name="opus",
                               remote="https://github.com/xiph/opus.git",
                               local="opus",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'libtool')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Opus.NAME))

        binary_map.specify_binary(".libs/libopus.so",
                                  BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        opus_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        clang = bb.compiler.cc(self)
        with local.cwd(opus_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("opus-codec", "opus")]
Esempio n. 18
0
class Libvpx(VProject):
    """Codec SDK libvpx (fetched by Git)"""

    NAME = 'libvpx'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.CODEC

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libvpx",
            remote="https://github.com/webmproject/libvpx.git",
            local="libvpx",
            refspec="origin/HEAD",
            limit=None,
            shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'yasm')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash  # pylint: disable=W0613
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Libvpx.NAME))

        binary_map.specify_binary("vpxdec", BinaryType.EXECUTABLE)
        binary_map.specify_binary("vpxenc", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libvpx_source = local.path(self.source_of_primary)

        self.cflags += ["-fPIC"]

        clang = bb.compiler.cc(self)
        with local.cwd(libvpx_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("john_koleszar", "libvpx")]
Esempio n. 19
0
class Htop(VProject):
    """Process visualization tool (fetched by Git)"""

    NAME = 'htop'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="htop",
                               remote="https://github.com/htop-dev/htop.git",
                               local="htop",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'autoconf', 'automake', 'autotools-dev',
        'libtool')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Htop.NAME))

        binary_map.specify_binary('htop', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        htop_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(htop_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Htop", "Htop")]
Esempio n. 20
0
class Bitlbee(VProject):
    """
    BitlBee brings IM (instant messaging) to IRC clients.

    (fetched by Git)
    """

    NAME = 'bitlbee'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.CHAT_CLIENT

    SOURCE = [
        PaperConfigSpecificGit("bitlbee",
                               remote="https://github.com/bitlbee/bitlbee.git",
                               local="bitlbee",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            Bitlbee.NAME))

        binary_map.specify_binary('bitlbee', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        bitlbee_source = local.path(self.source_of(self.primary_source))

        compiler = bb.compiler.cc(self)
        with local.cwd(bitlbee_source):
            with local.env(CC=str(compiler)):
                bb.watch(local["./configure"])()

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Bitlbee", "Bitlbee"), ("Bitlbee", "Bitlbee-libpurple")]
Esempio n. 21
0
class Tmux(VProject):
    """Terminal multiplexer Tmux."""

    NAME = 'tmux'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(project_name="tmux",
                               remote="https://github.com/tmux/tmux.git",
                               local="tmux",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'libevent-dev', 'pkg-config', 'bison',
        'autoconf', 'automake')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Tmux.NAME))

        binary_map.specify_binary("tmux", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        tmux_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(tmux_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./autogen.sh"])()
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("nicholas_marriott", "tmux")]
Esempio n. 22
0
class LibjpegTurbo(VProject):
    """libjpeg-turbo is a JPEG image codec."""

    NAME = 'libjpeg_turbo'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.FILE_FORMAT

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="libjpeg_turbo",
            remote="https://github.com/libjpeg-turbo/libjpeg-turbo",
            local="libjpeg-turbo",
            refspec="origin/HEAD",
            limit=None,
            shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(
            get_local_project_git_path(LibjpegTurbo.NAME))

        binary_map.specify_binary("libjpeg.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libjpeg_version_source = local.path(self.source_of_primary)

        c_compiler = bb.compiler.cc(self)
        with local.cwd(libjpeg_version_source):
            with local.env(CC=str(c_compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", ".")
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("JpegCodec", "Libjpeg")]
Esempio n. 23
0
class Lz4(VProject):
    """
    LZ4 is lossless compression algorithm.

    (fetched by Git)
    """

    NAME = 'lz4'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        PaperConfigSpecificGit(project_name="lz4",
                               remote="https://github.com/lz4/lz4.git",
                               local="lz4",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10)

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Lz4.NAME))

        binary_map.specify_binary('lz4', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        lz4_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(lz4_source):
            with local.env(CC=str(clang)):
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Yann Collet", "LZ4")]
Esempio n. 24
0
class Bzip2(VProject):
    """Compression and decompression tool bzip2 (fetched by Git)"""

    NAME = 'bzip2'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="bzip2",
            remote="https://github.com/libarchive/bzip2.git",
            local="bzip2",
            refspec="origin/HEAD",
            limit=None,
            shallow=False)
    ]

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Bzip2.NAME))

        binary_map.specify_binary('build/bzip2', BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        bzip2_source = local.path(self.source_of(self.primary_source))

        cc_compiler = bb.compiler.cc(self)
        cxx_compiler = bb.compiler.cxx(self)

        mkdir("-p", bzip2_source / "build")

        with local.cwd(bzip2_source / "build"):
            with local.env(CC=str(cc_compiler), CXX=str(cxx_compiler)):
                bb.watch(cmake)("..")

            bb.watch(cmake)("--build", ".", "--config", "Release", "-j",
                            get_number_of_jobs(bb_cfg()))

        with local.cwd(bzip2_source):
            verify_binaries(self)
Esempio n. 25
0
class OpenSSL(VProject):
    """TLS-framework OpenSSL (fetched by Git)"""

    NAME = 'openssl'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.SECURITY

    SOURCE = [
        PaperConfigSpecificGit(project_name="openssl",
                               remote="https://github.com/openssl/openssl.git",
                               local="openssl",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'perl')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(
            OpenSSL.NAME))

        binary_map.specify_binary("libssl.so", BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        openssl_source = local.path(self.source_of_primary)

        compiler = bb.compiler.cc(self)
        with local.cwd(openssl_source):
            with local.env(CC=str(compiler)):
                bb.watch(local['./config'])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("openssl_project", "openssl"), ("openssl", "openssl")]
Esempio n. 26
0
class Busybox(VProject):
    """UNIX utility wrapper BusyBox."""

    NAME = 'busybox'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.UNIX_TOOLS

    SOURCE = [
        PaperConfigSpecificGit(
            project_name="busybox",
            remote="https://github.com/mirror/busybox.git",
            local="busybox",
            refspec="origin/HEAD",
            limit=None,
            shallow=False
        )
    ]

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Busybox.NAME))

        binary_map.specify_binary("PLEASE_REPLACE_ME", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        busybox_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(busybox_source):
            with local.env(CC=str(clang)):
                bb.watch(make)("defconfig")
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("busybox", "busybox")]
Esempio n. 27
0
class Git(VProject):
    """Git."""

    NAME = 'git'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.VERSION_CONTROL

    SOURCE = [
        PaperConfigSpecificGit(project_name="git",
                               remote="https://github.com/git/git.git",
                               local="git",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Git.NAME))

        binary_map.specify_binary("git", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        git_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(git_source):
            with local.env(CC=str(clang)):
                delete("configure", "config.status")
                bb.watch(make)("configure")
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("git", "git")]
Esempio n. 28
0
class Vim(VProject):
    """Text processing tool vim."""

    NAME = 'vim'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.EDITOR

    SOURCE = [
        PaperConfigSpecificGit(project_name="vim",
                               remote="https://github.com/vim/vim.git",
                               local="vim",
                               refspec="origin/HEAD",
                               limit=None,
                               shallow=False)
    ]

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Vim.NAME))

        binary_map.specify_binary("src/vim", BinaryType.EXECUTABLE)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        vim_source = local.path(self.source_of_primary)

        clang = bb.compiler.cc(self)
        with local.cwd(vim_source):
            with local.env(CC=str(clang)):
                bb.watch(local["./configure"])()
            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("vim_development_group", "vim"), ("vim", "vim")]
Esempio n. 29
0
class Libpng(VProject):
    """
    Picture library.

    (fetched by Git)
    """

    NAME = 'libpng'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.FILE_FORMAT

    SOURCE = [
        block_revisions([
            GoodBadSubgraph(["8694cd8bf5f7d0d2739e503218eaf749c6cb7071"],
                            ["0e13545712dc39db5689452ff3299992fc0a8377"],
                            "missing generic libpng.so"),
            GoodBadSubgraph(["9d2ab7b40505c5e94a7783e80217b60f474488fe"],
                            ["b17c75b222942a31394e65c0c1da9fd7ec9f3a4c"],
                            "missing generic libpng.so"),
            GoodBadSubgraph(["0d5805822f8817a17937462a2fd0606ffdad378e"],
                            ["917648ecb92f45537924b3c46a4a811b956c7023"],
                            "build not atomatable"),
            GoodBadSubgraph(["917648ecb92f45537924b3c46a4a811b956c7023"], [
                "9d2ab7b40505c5e94a7783e80217b60f474488fe",
                "6611322a8b29103a160c971819f1c5a031cd9d4f"
            ], "cmake not available"),
            GoodBadSubgraph(["a04b5352310727f20b38e360006feeca94b7201f"],
                            ["0e13545712dc39db5689452ff3299992fc0a8377"],
                            "Not libpng"),
            GoodBadSubgraph(["e209df47c4b821f277504e0cc248d9022b639e55"],
                            ["d61b42c81d9d6f0905039ccc66870b2a27eafdd9"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["8d9e494dfb208c88a9497038977b539310c7fca5"],
                            ["bf15ac7e86f4fc95b6b33831f212c3f13f955623"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["7de02e722f8f6bdb2756e20091c42fa4ffaa89c1"],
                            ["45bb9a62ba343250497c33da2b0bad78376d55b8"],
                            "Bug in Libpng"),
            SingleRevision(
                "79b7e4e621fd611df658ec24a07080708fffe1de", "Bug in Libpng"
            ),
            SingleRevision(
                "67a289ffa924a00fab96a9bd6da8c069441138fa", "Bug in Libpng"
            ),
            GoodBadSubgraph(["b76ab1260d156a390a47f81c0ea6ef0524208b8e"],
                            ["e4f124e3352d63f7162ab7c1360a2db6d54f2ff2"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["5bc90389bffa3cf3d2b8325bfac5c4344a206bc0"],
                            ["c35f888c46986093582f73cafcd7185472748e4b"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["5b79cd52f440a7e1ce418f87b92b526765719c54"],
                            ["c4081f05c88d171cd476d5df78ed4a690296c602"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["9c946e22fcad10c2a44c0380c0909da6732097ce"],
                            ["342c4eab2a0565de456f1f3efcc41b635544160e"],
                            "Bug in Libpng"),
            GoodBadSubgraph(["40afb685704f1a5bf8d9edc0b5c7ec7f25e94b77"],
                            ["619cf868e60807d759639cfb070987ad059fa0c9"],
                            "Bug in Libpng"),
            SingleRevision(
                "7c709f039f7ff3cc92eea03af0660a171ef0673d", "Bug in Libpng"
            ),
            SingleRevision(
                "3fa1df48a1c14d3004733471ce7fbce916750911", "Bug in Libpng"
            ),
            SingleRevision(
                "a1312f7b190df545fb7ec90e23cc4a9b6328af00", "Bug in Libpng"
            ),
            SingleRevision(
                "42369ccd85a48c0802093ecf02444cc4dfc4f1dd", "Bug in Libpng"
            ),
            SingleRevision(
                "d930d36155fe79b277c11d868572769cb4ffb586", "Bug in Libpng"
            ),
            SingleRevision(
                "6e8ba0fab666eb6c90e929988e8fb3439449e7f9", "Bug in Libpng"
            ),
            SingleRevision(
                "ad41b8838a91ab36880716c2264f70ef4651b89f", "Bug in Libpng"
            ),
            GoodBadSubgraph(["d332c67da7818132e462fc44ec28b0b7420bc5b5"],
                            ["1d7f56ab64f397d5841cc277fae7aeaac44ac088"],
                            "Bug in Libpng"),
            SingleRevision(
                "db67cba8d42f5f13a96ce6080a61567f66afd915", "Bug in Libpng"
            ),
            SingleRevision(
                "c9e27d026de520a8646f8f5ee6d20a4080d258b6", "Bug in Libpng"
            ),
            SingleRevision(
                "7b9796539d8d15a61f2aa495fd23fbd5b4a90335", "Bug in Libpng"
            ),
            GoodBadSubgraph(["05a4db1fcd776931bbba0c3472ada94014c3a395"], [
                "403636577395221e63e27b69c5546ae6606f4fa2",
                "2e7c3a6e706e8d3cb54587c2bf8b3b3fdc30ae5a"
            ], "Bug in Libpng"),
            SingleRevision(
                "6cae24c265ea7a3d19a1655b0f7692ada4273290", "Bug in Libpng"
            ),
            SingleRevision(
                "04336ba10ff4da8b69292f6c936c4c0d7bbe67c7", "Bug in Libpng"
            )
        ])(
            PaperConfigSpecificGit(
                project_name="libpng",
                remote="https://github.com/glennrp/libpng.git",
                local="libpng",
                refspec="origin/HEAD",
                limit=None,
                shallow=False
            )
        )
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10
                              ).run('apt', 'install', '-y', 'cmake')

    @staticmethod
    def binaries_for_revision(
        revision: ShortCommitHash
    ) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Libpng.NAME))

        binary_map.specify_binary('build/libpng.so', BinaryType.SHARED_LIBRARY)

        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        libpng_source = local.path(self.source_of(self.primary_source))

        compiler = bb.compiler.cc(self)
        mkdir(libpng_source / "build")
        with local.cwd(libpng_source / "build"):
            with local.env(CC=str(compiler)):
                bb.watch(cmake)("-G", "Unix Makefiles", "..")

            bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
        with local.cwd(libpng_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("Libpng", "Libpng")]
Esempio n. 30
0
class Brotli(VProject):
    """Brotli compression format."""

    NAME = 'brotli'
    GROUP = 'c_projects'
    DOMAIN = ProjectDomains.COMPRESSION

    SOURCE = [
        block_revisions([
            RevisionRange('8f30907d0f2ef354c2b31bdee340c2b11dda0fb0',
                          'e1739826c04a9944672b99b98249dda021bdeb36',
                          'Encoder and Decoder don\'t have a shared Makefile'),
            SingleRevision("378485b097fd7b80a5e404a3cb912f7b18f78cdb",
                           "Missing required build files")
        ])(PaperConfigSpecificGit(
            project_name="brotli",
            remote="https://github.com/google/brotli.git",
            local="brotli_git",
            refspec="origin/HEAD",
            limit=None,
            shallow=False))
    ]

    CONTAINER = get_base_image(ImageBase.DEBIAN_10).run(
        'apt', 'install', '-y', 'cmake')

    @staticmethod
    def binaries_for_revision(
            revision: ShortCommitHash) -> tp.List[ProjectBinaryWrapper]:
        binary_map = RevisionBinaryMap(get_local_project_git_path(Brotli.NAME))

        binary_map.specify_binary(
            "out/brotli",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "03739d2b113afe60638069c4e1604dc2ac27380d", "HEAD"))
        binary_map.specify_binary(
            "out/bro",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "5814438791fb2d4394b46e5682a96b68cd092803",
                "03739d2b113afe60638069c4e1604dc2ac27380d"))
        binary_map.specify_binary(
            "bin/bro",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "f9ab24a7aaee93d5932ba212e5e3d32e4306f748",
                "5814438791fb2d4394b46e5682a96b68cd092803"))
        binary_map.specify_binary(
            "tools/bro",
            BinaryType.EXECUTABLE,
            only_valid_in=RevisionRange(
                "e1739826c04a9944672b99b98249dda021bdeb36",
                "378485b097fd7b80a5e404a3cb912f7b18f78cdb"))
        return binary_map[revision]

    def run_tests(self) -> None:
        pass

    def compile(self) -> None:
        """Compile the project."""
        brotli_version_source = local.path(self.source_of_primary)
        brotli_git_path = get_local_project_git_path(self.NAME)
        brotli_version = ShortCommitHash(self.version_of_primary)
        with local.cwd(brotli_git_path):
            configure_revisions = get_all_revisions_between(
                "f9ab24a7aaee93d5932ba212e5e3d32e4306f748",
                "5814438791fb2d4394b46e5682a96b68cd092803", ShortCommitHash)
            simple_make_revisions = get_all_revisions_between(
                "e1739826c04a9944672b99b98249dda021bdeb36",
                "378485b097fd7b80a5e404a3cb912f7b18f78cdb", ShortCommitHash)
        c_compiler = bb.compiler.cc(self)

        if brotli_version in simple_make_revisions:
            with local.cwd(brotli_version_source / "tools"):
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
        elif brotli_version in configure_revisions:
            with local.cwd(brotli_version_source):
                with local.env(CC=str(c_compiler)):
                    bb.watch(local["./configure"])()
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))
        else:
            mkdir(brotli_version_source / "out")
            with local.cwd(brotli_version_source / "out"):
                with local.env(CC=str(c_compiler)):
                    bb.watch(local["../configure-cmake"])()
                bb.watch(make)("-j", get_number_of_jobs(bb_cfg()))

        with local.cwd(brotli_version_source):
            verify_binaries(self)

    @classmethod
    def get_cve_product_info(cls) -> tp.List[tp.Tuple[str, str]]:
        return [("google", "brotli")]