nus-yam/ex-repair huggingface dataset:
Program: CWE-20
Project: CVE-2021-21322
Buggy source:
{
  "name": "fastify-http-proxy",
  "version": "4.3.0",
  "description": "proxy http requests, for Fastify",
  "main": "index.js",
  "scripts": {
    "test": "standard | snazzy && tap test/*.js && npm run typescript",
    "lint:fix": "standard --fix",
    "lint:typescript": "standard --fix --parser @typescript-eslint/parser --plugin typescript test/types/*.ts",
    "typescript": "tsd"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/fastify/fastify-http-proxy.git"
  },
  "keywords": [
    "fastify",
    "http",
    "proxy"
  ],
  "author": "Matteo Collina <hello@matteocollina.com>",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/fastify/fastify-http-proxy/issues"
  },
  "homepage": "https://github.com/fastify/fastify-http-proxy#readme",
  "devDependencies": {
    "@types/node": "^14.0.27",
    "@types/ws": "^7.4.0",
    "@typescript-eslint/parser": "^4.0.0",
    "eslint-plugin-typescript": "^0.14.0",
    "express": "^4.16.4",
    "express-http-proxy": "^1.6.2",
    "fast-proxy": "^1.7.0",
    "fastify": "^3.0.0",
    "got": "^11.5.1",
    "http-errors": "^1.8.0",
    "http-proxy": "^1.17.0",
    "make-promises-safe": "^5.0.0",
    "simple-get": "^4.0.0",
    "snazzy": "^9.0.0",
    "socket.io": "^3.0.4",
    "socket.io-client": "^3.0.4",
    "standard": "^16.0.3",
    "tap": "^14.10.8",
    "tsd": "^0.14.0",
    "typescript": "^4.0.2"
  },
  "dependencies": {
    "fastify-reply-from": "^4.0.0",
    "ws": "^7.4.1"
  },
  "tsd": {
    "directory": "test"
  }
}


Fixed version (ground truth):
{
  "name": "fastify-http-proxy",
  "version": "4.3.0",
  "description": "proxy http requests, for Fastify",
  "main": "index.js",
  "scripts": {
    "test": "standard | snazzy && tap test/*.js && npm run typescript",
    "lint:fix": "standard --fix",
    "lint:typescript": "standard --fix --parser @typescript-eslint/parser --plugin typescript test/types/*.ts",
    "typescript": "tsd"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/fastify/fastify-http-proxy.git"
  },
  "keywords": [
    "fastify",
    "http",
    "proxy"
  ],
  "author": "Matteo Collina <hello@matteocollina.com>",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/fastify/fastify-http-proxy/issues"
  },
  "homepage": "https://github.com/fastify/fastify-http-proxy#readme",
  "devDependencies": {
    "@types/node": "^14.0.27",
    "@types/ws": "^7.4.0",
    "@typescript-eslint/parser": "^4.0.0",
    "eslint-plugin-typescript": "^0.14.0",
    "express": "^4.16.4",
    "express-http-proxy": "^1.6.2",
    "fast-proxy": "^1.7.0",
    "fastify": "^3.0.0",
    "fastify-websocket": "^3.0.0",
    "got": "^11.5.1",
    "http-errors": "^1.8.0",
    "http-proxy": "^1.17.0",
    "make-promises-safe": "^5.0.0",
    "simple-get": "^4.0.0",
    "snazzy": "^9.0.0",
    "socket.io": "^3.0.4",
    "socket.io-client": "^3.0.4",
    "standard": "^16.0.3",
    "tap": "^14.10.8",
    "tsd": "^0.14.0",
    "typescript": "^4.0.2"
  },
  "dependencies": {
    "fastify-reply-from": "^4.0.0",
    "ws": "^7.4.1"
  },
  "tsd": {
    "directory": "test"
  }
}
Program: CWE-20
Project: CVE-2021-21372
Buggy source:
{
  "name": "fastify-http-proxy",
  "version": "4.3.0",
  "description": "proxy http requests, for Fastify",
  "main": "index.js",
  "scripts": {
    "test": "standard | snazzy && tap test/*.js && npm run typescript",
    "lint:fix": "standard --fix",
    "lint:typescript": "standard --fix --parser @typescript-eslint/parser --plugin typescript test/types/*.ts",
    "typescript": "tsd"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/fastify/fastify-http-proxy.git"
  },
  "keywords": [
    "fastify",
    "http",
    "proxy"
  ],
  "author": "Matteo Collina <hello@matteocollina.com>",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/fastify/fastify-http-proxy/issues"
  },
  "homepage": "https://github.com/fastify/fastify-http-proxy#readme",
  "devDependencies": {
    "@types/node": "^14.0.27",
    "@types/ws": "^7.4.0",
    "@typescript-eslint/parser": "^4.0.0",
    "eslint-plugin-typescript": "^0.14.0",
    "express": "^4.16.4",
    "express-http-proxy": "^1.6.2",
    "fast-proxy": "^1.7.0",
    "fastify": "^3.0.0",
    "got": "^11.5.1",
    "http-errors": "^1.8.0",
    "http-proxy": "^1.17.0",
    "make-promises-safe": "^5.0.0",
    "simple-get": "^4.0.0",
    "snazzy": "^9.0.0",
    "socket.io": "^3.0.4",
    "socket.io-client": "^3.0.4",
    "standard": "^16.0.3",
    "tap": "^14.10.8",
    "tsd": "^0.14.0",
    "typescript": "^4.0.2"
  },
  "dependencies": {
    "fastify-reply-from": "^4.0.0",
    "ws": "^7.4.1"
  },
  "tsd": {
    "directory": "test"
  }
}


Fixed version (ground truth):
{
  "name": "fastify-http-proxy",
  "version": "4.3.0",
  "description": "proxy http requests, for Fastify",
  "main": "index.js",
  "scripts": {
    "test": "standard | snazzy && tap test/*.js && npm run typescript",
    "lint:fix": "standard --fix",
    "lint:typescript": "standard --fix --parser @typescript-eslint/parser --plugin typescript test/types/*.ts",
    "typescript": "tsd"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/fastify/fastify-http-proxy.git"
  },
  "keywords": [
    "fastify",
    "http",
    "proxy"
  ],
  "author": "Matteo Collina <hello@matteocollina.com>",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/fastify/fastify-http-proxy/issues"
  },
  "homepage": "https://github.com/fastify/fastify-http-proxy#readme",
  "devDependencies": {
    "@types/node": "^14.0.27",
    "@types/ws": "^7.4.0",
    "@typescript-eslint/parser": "^4.0.0",
    "eslint-plugin-typescript": "^0.14.0",
    "express": "^4.16.4",
    "express-http-proxy": "^1.6.2",
    "fast-proxy": "^1.7.0",
    "fastify": "^3.0.0",
    "fastify-websocket": "^3.0.0",
    "got": "^11.5.1",
    "http-errors": "^1.8.0",
    "http-proxy": "^1.17.0",
    "make-promises-safe": "^5.0.0",
    "simple-get": "^4.0.0",
    "snazzy": "^9.0.0",
    "socket.io": "^3.0.4",
    "socket.io-client": "^3.0.4",
    "standard": "^16.0.3",
    "tap": "^14.10.8",
    "tsd": "^0.14.0",
    "typescript": "^4.0.2"
  },
  "dependencies": {
    "fastify-reply-from": "^4.0.0",
    "ws": "^7.4.1"
  },
  "tsd": {
    "directory": "test"
  }
}
Program: CWE-20
Project: CVE-2021-21431
Buggy source:
"""Set up the package for the plugin."""

from setuptools import find_packages, setup

with open('README.md') as readme_file:
    readme = readme_file.read()
with open('requirements.txt') as requirements_file:
    requirements = list(requirements_file.readlines())


setup(
    name='sopel_plugins.channelmgnt',
    version='2.0',
    description='Channelmgnt plugin for Sopel',
    long_description=readme,
    long_description_content_type='text/markdown',  # This is important!
    author='MirahezeBot Contributors',
    author_email='bots@miraheze.org',
    url='https://github.com/MirahezeBots/sopel-channelmgnt',
    packages=find_packages('.'),
    include_package_data=True,
    install_requires=requirements,
    license='Eiffel Forum License, version 2',
)


Fixed version (ground truth):
"""Set up the package for the plugin."""

from setuptools import find_packages, setup

with open('README.md') as readme_file:
    readme = readme_file.read()
with open('requirements.txt') as requirements_file:
    requirements = list(requirements_file.readlines())


setup(
    name='sopel_plugins.channelmgnt',
    version='2.0.1',
    description='Channelmgnt plugin for Sopel',
    long_description=readme,
    long_description_content_type='text/markdown',  # This is important!
    author='MirahezeBot Contributors',
    author_email='staff@mirahezebots.org',
    url='https://github.com/MirahezeBots/sopel-channelmgnt',
    packages=find_packages('.'),
    include_package_data=True,
    install_requires=requirements,
    license='Eiffel Forum License, version 2',
)
Program: CWE-20
Project: CVE-2021-39193
Buggy source:
None

Fixed version (ground truth):
import { expect } from "chai";
import { step } from "mocha-steps";

import { describeWithFrontier, customRequest } from "./util";

describeWithFrontier("Frontier RPC (Transaction cost)", (context) => {

	step("should take transaction cost into account and not submit it to the pool", async function () {
		// Simple transfer with gas limit 0 manually signed to prevent web3 from rejecting client-side.
		const tx = await customRequest(context.web3, "eth_sendRawTransaction", [
			"0xf86180843b9aca00809412cb274aad8251c875c0bf6872b67d9983e53fdd01801ca00e28ba2dd3c5a3fd467\
			d4afd7aefb4a34b373314fff470bb9db743a84d674a0aa06e5994f2d07eafe1c37b4ce5471caecec29011f6f5b\
			f0b1a552c55ea348df35f",
		]);
		let msg =
			"submit transaction to pool failed: Pool(InvalidTransaction(InvalidTransaction::Custom(3)))";
		expect(tx.error).to.include({
			message: msg,
		});
	});
});
Program: CWE-20
Project: CVE-2022-23624
Buggy source:
import { defineController } from './$relay'

export type AdditionalRequest = {
  name: string
}

export default defineController(() => ({
  get: ({ params }) => ({ status: 200, body: { id: params.userId, name: 'bbb' } })
}))


Fixed version (ground truth):
import { defineController } from './$relay'

export type AdditionalRequest = {
  name: string
}

export default defineController(() => ({
  get: ({ params }) => ({
    status: 200,
    body: {
      id: params.userId,
      name: 'bbb',
      location: {
        country: 'JP',
        stateProvince: 'Tokyo'
      }
    }
  })
}))
Program: CWE-20
Project: CVE-2022-24774
Buggy source:
2.0.0


Fixed version (ground truth):
2.0.1
Program: CWE-20
Project: CVE-2022-24881
Buggy source:
package com.hccake.ballcat.codegen.engine;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;

import java.util.Map;

/**
 * 模板引擎的委托者
 * 
 * @author hccake
 */
public class TemplateEngineDelegator {

	public final Map<TemplateEngineTypeEnum, TemplateEngine> templateEngineMap;

	public TemplateEngineDelegator(Map<TemplateEngineTypeEnum, TemplateEngine> templateEngineMap) {
		this.templateEngineMap = templateEngineMap;
	}

	/**
	 * 渲染模板字符串
	 * @param templateContent 模板字符串
	 * @param context 渲染使用的上下文
	 * @return 渲染完成后的字符串
	 */
	public String render(TemplateEngineTypeEnum engineType, String templateContent, Map<String, Object> context) {
		if (StrUtil.isEmpty(templateContent)) {
			return StrUtil.EMPTY;
		}
		TemplateEngine templateEngine = templateEngineMap.get(engineType);
		Assert.notNull(templateEngine, "未找到对应的模板引擎：{}", engineType);
		return templateEngine.render(templateContent, context);
	}

}


Fixed version (ground truth):
package com.hccake.ballcat.codegen.engine;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.hccake.ballcat.codegen.exception.TemplateRenderException;

import java.util.Map;

/**
 * 模板引擎的委托者
 *
 * @author hccake
 */
public class TemplateEngineDelegator {

	public final Map<TemplateEngineTypeEnum, TemplateEngine> templateEngineMap;

	public TemplateEngineDelegator(Map<TemplateEngineTypeEnum, TemplateEngine> templateEngineMap) {
		this.templateEngineMap = templateEngineMap;
	}

	/**
	 * 渲染模板字符串
	 * @param templateContent 模板字符串
	 * @param context 渲染使用的上下文
	 * @return 渲染完成后的字符串
	 */
	public String render(TemplateEngineTypeEnum engineType, String templateContent, Map<String, Object> context)
			throws TemplateRenderException {
		if (StrUtil.isEmpty(templateContent)) {
			return StrUtil.EMPTY;
		}
		TemplateEngine templateEngine = templateEngineMap.get(engineType);
		Assert.notNull(templateEngine, "未找到对应的模板引擎：{}", engineType);
		return templateEngine.render(templateContent, context);
	}

}
Program: CWE-20
Project: CVE-2022-25839
Buggy source:
/**
 *  URL parser module.
 *
 *  @license MIT
 *  @version 2.0.0
 *  @author Dumitru Uzun (DUzun.Me)
 *  @umd AMD, Browser, CommonJs, noDeps
 */
export { default } from "./url/URL";


Fixed version (ground truth):
/**
 *  URL parser module.
 *
 *  @license MIT
 *  @version 2.1.0
 *  @author Dumitru Uzun (DUzun.Me)
 *  @umd AMD, Browser, CommonJs, noDeps
 */
export { default } from "./url/URL";
Program: CWE-125
Project: CVE-2013-7456
Buggy source:
None

Fixed version (ground truth):
--TEST--
Bug #72227: imagescale out-of-bounds read
--SKIPIF--
<?php
	if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php

$img = imagecreatetruecolor ( 100, 100);
imagescale($img, 13, 1, IMG_BICUBIC);
?>
DONE
--EXPECT--
DONE
Program: CWE-125
Project: CVE-2016-5093
Buggy source:
None

Fixed version (ground truth):
--TEST--
Bug #72241: get_icu_value_internal out-of-bounds read
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
$var1=str_repeat("A", 1000);
$out = locale_get_primary_language($var1);
echo strlen($out) . PHP_EOL;
echo unpack('H*', $out)[1] . PHP_EOL;
--EXPECT--
1000
61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
Program: CWE-125
Project: CVE-2016-6214
Buggy source:
libgd_test_programs += \
	tga/bug00084 \
	tga/bug00247 \
	tga/tga_null

EXTRA_DIST += \
	tga/CMakeLists.txt \
	tga/bug00084.tga \
	tga/bug00247.tga


Fixed version (ground truth):
libgd_test_programs += \
	tga/bug00084 \
	tga/bug00247 \
	tag/bug00247a \
	tga/tga_null

EXTRA_DIST += \
	tga/CMakeLists.txt \
	tga/bug00084.tga \
	tga/bug00247.tga \
	tga/bug00247a.tga
Program: CWE-125
Project: CVE-2016-6906
Buggy source:
libgd_test_programs += \
	tga/bug00084 \
	tga/bug00247 \
	tga/bug00247a \
	tga/bug00248 \
	tga/bug00248a \
	tga/heap_overflow \
	tga/tga_null \
	tga/tga_read

EXTRA_DIST += \
	tga/CMakeLists.txt \
	tga/bug00084.tga \
	tga/bug00247.tga \
	tga/bug00247a.tga \
	tga/bug00248.tga \
	tga/bug00248a.tga \
	tga/heap_overflow.tga \
	tga/tga_read_rgb.png \
	tga/tga_read_rgb.tga \
	tga/tga_read_rgb_rle.tga


Fixed version (ground truth):
libgd_test_programs += \
	tga/bug00084 \
	tga/bug00247 \
	tga/bug00247a \
	tga/bug00248 \
	tga/bug00248a \
	tga/heap_overflow \
	tga/tga_null \
	tga/tga_read

EXTRA_DIST += \
	tga/CMakeLists.txt \
	tga/bug00084.tga \
	tga/bug00247.tga \
	tga/bug00247a.tga \
	tga/bug00248.tga \
	tga/bug00248a.tga \
	tga/heap_overflow_1.tga \
	tga/heap_overflow_2.tga \
	tga/tga_read_rgb.png \
	tga/tga_read_rgb.tga \
	tga/tga_read_rgb_rle.tga
Program: CWE-125
Project: CVE-2016-6911
Buggy source:
IF(TIFF_FOUND)
LIST(APPEND TESTS_FILES
	tiff_im2im
	tiff_null
	tiff_dpi
)
ENDIF(TIFF_FOUND)

ADD_GD_TESTS()


Fixed version (ground truth):
IF(TIFF_FOUND)
LIST(APPEND TESTS_FILES
	tiff_im2im
	tiff_invalid_read
	tiff_null
	tiff_dpi
)
ENDIF(TIFF_FOUND)

ADD_GD_TESTS()
Program: CWE-125
Project: CVE-2016-8688
Buggy source:
None

Fixed version (ground truth):
begin 600 test_read_format_mtree_crash747.mtree.bz2
M0EIH.3%!62936:OH@(@``'/[@,`0`@!``'^```)A@9\`$`@@`'4)049!IIH!
MM021-0,F@&@6````9%>$(K!GIC*XFR0`$```J0+:$XP```!D-F)H[#SE9+2'
4+E"L=ASXUI%R(I"HD'ZA(5?1`Q``
`
end
Program: CWE-125
Project: CVE-2017-12893
Buggy source:
None

Fixed version (ground truth):
00:0c:85:0e:a5:ff > 00:00:0c:07:ac:f0, ethertype IPv4 (0x0800), length 92: (tos 0x0, ttl 127, id 38615, offset 0, flags [none], proto UDP (17), length 78)
    10.49.248.228.137 > 10.48.161.241.137: 
>>> NBT UDP PACKET(137): QUERY; REQUEST; UNICAST
TrnID=0x8D40
OpCode=0
NmFlags=0x10
Rcode=0
QueryCount=1
AnswerCount=0
AuthorityCount=0
AddressRecCount=0
QuestionRecords:
Name=
WARNING: Short packet. Try increasing the snap length
Program: CWE-125
Project: CVE-2017-12895
Buggy source:
None

Fixed version (ground truth):
Out 00:16:3e:27:78:a2 ethertype IPv4 (0x0800), length 204: truncated-ip - 13723 bytes missing! (tos 0x72,ECT(0), ttl 64, id 9472, offset 0, flags [none], proto ICMP (1), length 13911, bad cksum 67ea (->8c0c)!)
    62.220.31.247 > 62.225.245.115: ICMP 62.220.31.247 udp port 1027 unreachable, length 13891
	(tos 0xa0, ttl 114, id 30054, offset 0, flags [none], proto UDP (17), length 13728, bad cksum 3f1f (->a1f)!)
    62.225.245.115.9109 > 62.220.31.247.1027: [bad udp cksum 0xdfe7 -> 0xdb95!] UDP, length 132
	MPLS extension v0 packet not supported
Program: CWE-125
Project: CVE-2017-12896
Buggy source:
None

Fixed version (ground truth):
IP 48.48.48.48.4500 > 48.48.48.48.12336: [|isakmp]
Program: CWE-125
Project: CVE-2017-12899
Buggy source:
None

Fixed version (ground truth):
30:30:30:30:30:30 > 30:30:30:30:30:30, ethertype Unknown (0x3030), length 808464432: 
	0x0000:  3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
	0x0010:  3030 3030                                0000
MEDSA 16.6:48: [|decnet]
Program: CWE-125
Project: CVE-2017-12993
Buggy source:
None

Fixed version (ground truth):
[|juniper_atm1]
Program: CWE-125
Project: CVE-2017-13004
Buggy source:
None

Fixed version (ground truth):
[|juniper_hdr], length 808464432
Program: CWE-125
Project: CVE-2017-13007
Buggy source:
None

Fixed version (ground truth):
[|pktap]
[|ppp]
EXIT CODE 00000100
Program: CWE-125
Project: CVE-2017-13016
Buggy source:
None

Fixed version (ground truth):
UI 22! ES-IS, length 65565
	ESH (2), v: 1, checksum: 0x70a1 (incorrect should be 0xfc4c), holding time: 21315s, length indicator: 17
	  Number of Source Addresses: 3
	  NET (length: 0): isonsap_string: illegal length
	  NET (length: 4): ec.ff00.00
	  NET (length: 0): isonsap_string: illegal length
UI 22! ES-IS, length 65565
	redirect (6), v: 1, checksum: 0x7034 (incorrect should be 0x3ff0), holding time: 21315s, length indicator: 17
	  04
	  SNPA (length: 4): 00:00:00:00, bad opts/li
Program: CWE-125
Project: CVE-2017-13019
Buggy source:
None

Fixed version (ground truth):
IP (tos 0x41,ECT(1), id 0, offset 0, flags [none], proto PGM (113), length 32639, options (unknown 89 [bad length 232]), bad cksum 5959 (->96b9)!)
    128.121.89.107 > 89.89.16.63: 128.121.89.107.4 > 89.89.16.63.225: PGM, length 0 0x3414eb1f0022 UNKNOWN type 0x1f OPTS LEN 225 OPT_1F [13]  OPT_06 [26] [Bad OPT_PGMCC_DATA option, length 4 < 12]
Program: CWE-125
Project: CVE-2017-13022
Buggy source:
None

Fixed version (ground truth):
IP (tos 0x0, ttl 254, id 25615, offset 65480, flags [DF, rsvd], proto UDP (17), length 32768, options (LSRR [bad length 25] [bad ptr 15] 103.103.103.0, 0.172.0.116, 0.16.36.36, 16.0.36.2 14.9.36.4[|ip]))
    251.73.86.0 > 0.172.128.5: ip-proto-17
Program: CWE-125
Project: CVE-2017-13025
Buggy source:
None

Fixed version (ground truth):
IP6 (class 0x50, flowlabel 0x00004, hlim 0, next-header Mobile IP (old) (62) payload length: 7168) d400:7fa1:200:400::6238:2949 > 9675:86dd:7300:2c:1c7f:ffff:ffc3:b2a1: mobility: CoT nonce id=0x74 Care-of Init Cookie=80570f80:00000004[|MOBILITY]
IP6 (class 0x50, flowlabel 0x00004, hlim 0, next-header Mobile IP (old) (62) payload length: 7168) ffc3:b2a1:200:400::6238:2949 > 9675:86dd:73f0:2c:1c7f:ffff:ebc3:b2a1: mobility: BU seq#=39837 lifetime=261452[|MOBILITY]
Program: CWE-125
Project: CVE-2017-13027
Buggy source:
None

Fixed version (ground truth):
LLDP, length 1048572
	Management Address TLV (8), length 15
	  Management Address length 6, AFI Reserved (0), no AF printer !
	  Unknown Interface Numbering (10): 666137427
	[|LLDP]
00:00:00:a0:d4:c3 > 06:04:e8:03:00:02, ethertype Unknown (0xb2a1), length 58785857: 
	0x0000:  0200 efff e5ff 804f 006e 0026 0000 0000  .......O.n.&....
	0x0010:  01                                       .
Program: CWE-125
Project: CVE-2017-13028
Buggy source:
None

Fixed version (ground truth):
IP (tos 0x0, ttl 252, id 40207, offset 0, flags [+, DF, rsvd], proto UDP (17), length 60951, bad cksum ff (->8336)!)
    18.0.0.15.16896 > 107.95.83.32.68: BOOTP/DHCP, unknown (0x00), length 59384, htype 0, hlen 0, hops 13, xid 0x14000000, secs 3328 [|bootp]
Program: CWE-125
Project: CVE-2017-13029
Buggy source:
None

Fixed version (ground truth):
: CCP, Conf-Request (0x01), id 223, length 125685
	encoded length 15 (=Option(s) length 11)
	  MVRCA Option (0x18), length 5[|ccp]
Program: CWE-125
Project: CVE-2017-13031
Buggy source:
None

Fixed version (ground truth):
IP6 (class 0x51, flowlabel 0xb2100, hlim 16, next-header Fragment (44) payload length: 27136) 452:22:19:0:41a:e4ff:10ff:484d > 2243:80:1400:100:19:ffff:ffff:fffb: [|frag]
Program: CWE-125
Project: CVE-2017-13033
Buggy source:
None

Fixed version (ground truth):
FRF.16 Frag, seq 193, Flags [Begin, End], UI 08! VTPv69, Message Subset advertisement (0x02), length 2126400013
	Domain name: , Seq number: 0, Config Rev 4040404[|vtp]
Program: CWE-125
Project: CVE-2017-13035
Buggy source:
None

Fixed version (ground truth):
UI 22! IS-IS, length 469869187
	L2 Lan IIH, hlen: 27, v: 1, pdu-v: 1, sys-id-len: 6 (0), max-area: 224 (224)
	  source-id: fed0.f90f.58af,  holding time: 34047s, Flags: [unknown circuit type 0x00]
	  lan-id:    0105.0088.a204.00, Priority: 65, PDU length: 4096
	    unknown TLV #64, length: 128
		0x0000:  ff10 8e12 0001 1b01 0000 6b00 fbcf f90f
		0x0010:  58af 84ff 1000 4901 0000 88a2 011c 000c
		0x0020:  0281 0083 1b01 0010 019d e000 fed0 f90f
		0x0030:  58af 84ff 1000 4101 0500 88a2 011c 0272
		0x0040:  0c2a 2205 831b 011c 0010 0000 0583 1b01
		0x0050:  0010 01ab e000 fe08 0808 0808 08cb 0808
		0x0060:  0808 0808 0808 0880 0008 7f08 0808 0808
		0x0070:  08fd 0808 080c 0608 0807 0808 0808 0408
	    Padding TLV #8, length: 8
	    Padding TLV #8, length: 8
	    Padding TLV #8, length: 7
	    Padding TLV #8, length: 8
	    Padding TLV #8, length: 0
	    Padding TLV #8, length: 8
	    unknown TLV #100, length: 0
	    unknown TLV #32, length: 16
		0x0000:  2020 2020 3c20 2020 2020 2020 205a 1a31
	    IS Neighbor(s) (variable length) TLV #7, length: 238
	      LAN address length 1 bytes 
		IS Neighbor: 5a
		IS Neighbor: 45
		IS Neighbor: 50
		IS Neighbor: 48
		IS Neighbor: 59
		IS Neighbor: 52
		IS Neighbor: 5f
		IS Neighbor: 43
		IS Neighbor: 54
		IS Neighbor: 4c
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 08
		IS Neighbor: 00
		IS Neighbor: 00
		IS Neighbor: 08
		IS Neighbor: 00
		IS Neighbor: 20
		IS Neighbor: 64
		IS Neighbor: 00
		IS Neighbor: 20
		IS Neighbor: 10
		IS Neighbor: 20
		IS Neighbor: 20
		IS Neighbor: 20
		IS Neighbor: 20
		IS Neighbor: 20
		IS Neighbor: 20
		IS Neighbor: 20
		IS Neighbor: 20 [|isis]
Program: CWE-125
Project: CVE-2017-13038
Buggy source:
None

Fixed version (ground truth):
MLPPP, [|mlppp]
Program: CWE-125
Project: CVE-2017-13044
Buggy source:
None

Fixed version (ground truth):
IP truncated-ip - 260 bytes missing! (tos 0x12,ECT(0), ttl 48, id 21323, offset 0, flags [+, DF, rsvd], proto UDP (17), length 296, bad cksum 8e0f (->cd08)!)
    1.2.7.0.1812 > 128.253.0.96.8231: hncp (268)
	DHCPv4-Data (6)
		DNS-server (98) (invalid)
Program: CWE-125
Project: CVE-2017-13047
Buggy source:
UI 22! ES-IS, length 65565
	ESH (2), v: 1, checksum: 0x70a1 (incorrect should be 0xfb4e), holding time: 21315s, length indicator: 17
	  Number of Source Addresses: 2
	  NET (length: 0): isonsap_string: illegal length
	  NET (length: 4): ec.ff00.00, bad opts/li
UI 22! ES-IS, length 65565
	redirect (6), v: 1, checksum: 0x7034 (incorrect should be 0x44ec), holding time: 21315s, length indicator: 16
	  02.0400
	  SNPA (length: 0): <empty>
	  Unknown Option #0, length 0, value: 
UI 32! ES-IS, length 65565
	ESH (2), v: 1, checksum: 0x70a1 (incorrect should be 0xfb4e), holding time: 21315s, length indicator: 17
	  Number of Source Addresses: 2
	  NET (length: 0): isonsap_string: illegal length
	  NET (length: 4): ec.ff00.00, bad opts/li
UI 22! ES-IS, length 4244701213
	redirect (6), v: 1, checksum: 0x7034 (incorrect should be 0x36fe), holding time: 21315s, length indicator: 17
	  isonsap_string: illegal length
	  SNPA (length: 0): <empty>
	  NET (length: 4) 00.0000.00
Q.922, invalid address


Fixed version (ground truth):
UI 22! ES-IS, length 65565
	ESH (2), v: 1, checksum: 0x70a1 (incorrect should be 0xfb4e), holding time: 21315s, length indicator: 17
	  Number of Source Addresses: 2
	  NET (length: 0): isonsap_string: illegal length
	  NET (length: 4): ec.ff00.00, bad opts/li
UI 22! ES-IS, length 65565
	redirect (6), v: 1, checksum: 0x7034 (incorrect should be 0x44ec), holding time: 21315s, length indicator: 16
	  02.0400
	  SNPA (length: 0): <empty>
	  Unknown Option #0, length 0, value: [|esis]
UI 32! ES-IS, length 65565
	ESH (2), v: 1, checksum: 0x70a1 (incorrect should be 0xfb4e), holding time: 21315s, length indicator: 17
	  Number of Source Addresses: 2
	  NET (length: 0): isonsap_string: illegal length
	  NET (length: 4): ec.ff00.00, bad opts/li
UI 22! ES-IS, length 4244701213
	redirect (6), v: 1, checksum: 0x7034 (incorrect should be 0x36fe), holding time: 21315s, length indicator: 17
	  isonsap_string: illegal length
	  SNPA (length: 0): <empty>
	  NET (length: 4) 00.0000.00[|esis]
Q.922, invalid address
Program: CWE-125
Project: CVE-2017-13051
Buggy source:
None

Fixed version (ground truth):
IP (tos 0x0, ttl 48, id 25615, offset 0, flags [+, DF, rsvd], proto UDP (17), length 61735, bad cksum 8ef1 (->10e1)!)
    1.2.3.3.1812 > 64.112.0.96.4567:  wb-29!
IP (tos 0x2,ECT(0), ttl 248, id 0, offset 0, flags [none], proto RSVP (46), length 54312, bad cksum 3701 (->8972)!)
    54.35.0.0 > 47.16.0.0: 
	RSVPv1 Hello Message (20), Flags: [Refresh reduction capable], length: 65527, ttl: 15, checksum: 0x0902
	  Generalized UNI Object (229) Flags: [ignore and forward if unknown], Class-Type: 1 (1), length: 12
	    Subobject Type: Unknown (0), AF: HDLC (4), length: 1 (invalid)
IP (tos 0x2,ECT(0), ttl 248, id 0, offset 0, flags [none], proto RSVP (46), length 54312, bad cksum 3701 (->7e72)!)
    54.35.0.0 > 58.16.0.0: 
	RSVPv1 Hello Message (20), Flags: [Refresh reduction capable], length: 65527, ttl: 15, checksum: 0x0902
	  Generalized UNI Object (229) Flags: [ignore and forward if unknown], Class-Type: 1 (1), length: 12
	    Subobject Type: Unknown (225), AF: HDLC (4), length: 1 (invalid)
Program: CWE-125
Project: CVE-2017-13052
Buggy source:
None

Fixed version (ground truth):
CFMv0 unknown (255), MD Level 0, length 65556
	First TLV offset 0
	  0x0000:  ff00 0001 0004 0104 9a00 000c fb
	Unknown TLV (0xff), length 0
	Sender ID TLV (0x01), length 4
	  Chassis-ID Type MAC address (4), Chassis-ID length 1 (invalid MAC address length)
	  Management Address Domain Length 0
	End TLV (0x00)
Program: CWE-125
Project: CVE-2017-13053
Buggy source:
None

Fixed version (ground truth):
IP (tos 0xc, ttl 254, id 21263, offset 0, flags [rsvd], proto TCP (6), length 60165, bad cksum 8e15 (->9eb8)!)
    241.0.128.19.179 > 239.8.0.1.0: Flags [none], seq 2146695561:2146755682, win 56026, options [unknown-161,eol], length 60121: BGP
	Update Message (2), length: 45
	  Withdrawn routes: 3 bytes
	  Attribute Set (128), length: 7, Flags [OTPE+f]: 
	    Origin AS: 0
	      Multi-Protocol Unreach NLRI (15), length: 227, Flags [T+6]: 
	    AFI: IPv6 (2), SAFI: Multicast VPN (5)
	      Route-Type: Source-Active (5), length: 5, RD: unknown RD format, Group bogus address length 127
	      Route-Type: Unknown (142), length: 142
	      Route-Type: Unknown (0), length: 0
	      Route-Type: Unknown (33), length: 0
	      Route-Type: Unknown (0), length: 0[|BGP] [|BGP]
	Update Message (2), length: 45[|BGP] [|BGP]
	Update Message (2), length: 45
	  Withdrawn routes: 3 bytes
	  Attribute Set (128), length: 7, Flags [OTPE+f]: 
	    Origin AS: 0
	      Multi-Protocol Reach NLRI (14), length: 227, Flags [T+6]: 
	    AFI: IPv4 (1), vendor specific SAFI: Route Target Routing Information (132)
	    nexthop: invalid len, nh-length: 1, no SNPA
	      origin AS: 0, route target 0:0 (= 0.0.0.0)
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target
	      default route target[|BGP]
Program: CWE-125
Project: CVE-2017-16642
Buggy source:
None

Fixed version (ground truth):
TS: 0 | -99999--99999--99999 -1:45:00 | frONt of 0 0
TS: 0 | -99999--99999--99999 15:45:00 | frONt of 4pm
TS: 0 | -99999--99999--99999 15:45:00 | frONt of 4 pm
Program: CWE-125
Project: CVE-2017-6387
Buggy source:
#!/bin/sh
ASAN="address leak memory undefined"
ASAN="address"

printf "\033[32m"
echo "========================================================================="
printf "\033[33m"
echo "ASAN build script can be configured with the ASAN environment variable."
echo "Use one of the following words to specify which build flags to use:"
echo "  - address     - set by default, detect overflows"
echo "  - leak        - find memory leaks"
echo "  - memory      - detect uninitialized reads"
echo "  - undefined   - undefined behaviour"
echo "  - ..."
echo "For more information:"
echo "  http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation"
echo "For example:"
echo "  $ ASAN='leak memory address' sys/asan.sh"
echo "Current value:"
echo "  ASAN=${ASAN}"
printf "\033[32m"
echo "========================================================================="
printf "\033[0m"
sleep 1
export LDFLAGS="-lasan"

for a in $ASAN ; do
	export CFLAGS="${CFLAGS} -fsanitize=$a"
done
export CFLAGS="${CFLAGS} -lasan"

echo 'int main(){return 0;}' > .a.c
[ -z "${CC}" ] && CC=gcc
${CC} ${CFLAGS} ${LDFLAGS} -o .a.out .a.c
RET=$?
rm -f .a.out .a.c
if [ "$RET" != 0 ]; then
	echo "Your compiler doesn't support ASAN."
	exit 1
fi
exec sys/install.sh $*


Fixed version (ground truth):
#!/bin/sh
ASAN="address leak memory undefined"
ASAN="address"

printf "\033[32m"
echo "========================================================================="
printf "\033[33m"
echo "ASAN build script can be configured with the ASAN environment variable."
echo "Use one of the following words to specify which build flags to use:"
echo "  - address     - set by default, detect overflows"
echo "  - leak        - find memory leaks"
echo "  - memory      - detect uninitialized reads"
echo "  - undefined   - undefined behaviour"
echo "  - ..."
echo "For more information:"
echo "  http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation"
echo "For example:"
echo "  $ ASAN='leak memory address' sys/asan.sh"
echo "Current value:"
echo "  ASAN=${ASAN}"
printf "\033[32m"
echo "========================================================================="
printf "\033[0m"
sleep 1
#export LDFLAGS="-lasan"

for a in $ASAN ; do
	export CFLAGS="${CFLAGS} -fsanitize=$a"
done
#export CFLAGS="${CFLAGS} -lasan"

echo 'int main(){return 0;}' > .a.c
[ -z "${CC}" ] && CC=gcc
${CC} ${CFLAGS} ${LDFLAGS} -o .a.out .a.c
RET=$?
rm -f .a.out .a.c
if [ "$RET" != 0 ]; then
	echo "Your compiler doesn't support ASAN."
	exit 1
fi
exec sys/install.sh $*
Program: CWE-125
Project: CVE-2017-6801
Buggy source:
#!/bin/bash

set -ex

mkdir data

# First test that we can save attachments
../ytnef/ytnef -f data winmail.dat
for s in *.tnef
do
  ../ytnef/ytnef -f data $s
done

diff results data


# Now do some basic "deep checking" of specific fields.

../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_MESSAGE_DELIVERY_TIME | grep "Tuesday June 17, 2003 3:23:00 pm"
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_TNEF_CORRELATION_KEY  | grep "[00000000CFF233DD7623274EB78A4912C247A0E464532700.]"
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_RTF_SYNC_BODY_CRC     | grep 872404792
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_RTF_SYNC_BODY_COUNT   | grep 90
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 18 PR_RTF_COMPRESSED       | grep '\pard Casdasdfasdfasd\\par'


Fixed version (ground truth):
#!/bin/bash

set -ex

mkdir data

# First test that we can save attachments
../ytnef/ytnef -f data winmail.dat
for s in *.tnef
do
  ../ytnef/ytnef -f data $s
done

diff results data


# Now do some basic "deep checking" of specific fields.

../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_MESSAGE_DELIVERY_TIME | grep "Tuesday June 17, 2003 3:23:00 pm"
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_TNEF_CORRELATION_KEY  | grep "[00000000CFF233DD7623274EB78A4912C247A0E464532700.]"
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_RTF_SYNC_BODY_CRC     | grep 872404792
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 1 PR_RTF_SYNC_BODY_COUNT   | grep 90
../ytnefprint/ytnefprint ./winmail.dat  | grep -A 18 PR_RTF_COMPRESSED       | grep '\pard Casdasdfasdfasd\\par'

../ytnefprint/ytnefprint ./ytnef-oob-TNEFVersion-SwapWord | grep 'ERROR: Field with size of 0'
Program: CWE-125
Project: CVE-2019-11925
Buggy source:
None

Fixed version (ground truth):
Warning: File structure corrupted in %s/ext_gd/exifreaddata_APP12.php on line 7

Warning: Invalid JPEG file in %s/ext_gd/exifreaddata_APP12.php on line 7
bool(false)
Program: CWE-125
Project: CVE-2019-11926
Buggy source:
None

Fixed version (ground truth):
<?hh

<<__EntryPoint>>
function main_exifreaddata() {
  $jpeg = "\xff\xd8\xc9\x00\x03\x04\x03\xf8";
  $data_stream = "data://text/plain;base64," . base64_encode($jpeg);
  var_dump(exif_read_data($data_stream));
}
Program: CWE-125
Project: CVE-2019-3557
Buggy source:
None

Fixed version (ground truth):
<?hh

<<__EntryPoint>>
function main() {
    $a = bzopen("/dev/null", "w");
    $tmp = stream_get_line($a, 1, "1");
    var_dump($tmp);

    $a = fopen("php://output", "w");
    $tmp = stream_get_line($a, 1, "1");
    var_dump($tmp);
}
Program: CWE-125
Project: CVE-2020-1912
Buggy source:
None

Fixed version (ground truth):
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

// RUN: %hermes -lazy %s | %FileCheck %s --match-full-lines

// Make sure we can correctly resolve scopes through lazily compiled
// functions in lazily compiled generators.
function f() {
  var f_var = 10;
  function* g() {
    var g_var = 32;
    function h() {
      /* Some text to pad out the function so that it won't be eagerly compiled
       * for being too short. Lorem ipsum dolor sit amet, consectetur adipiscing
       * elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
       */
      return f_var + g_var;
    }
    yield h();
  }
  return g().next().value;
}
// CHECK: 42
print(f());
Program: CWE-125
Project: CVE-2020-9365
Buggy source:

#include <config.h>

#include "ftpd.h"
#include "utils.h"

#ifdef WITH_DMALLOC
# include <dmalloc.h>
#endif

#ifdef HAVE_LIBSODIUM
# if !defined(pure_memzero) || !defined(pure_memcmp)
#  error pure_memzero/pure_memcmp not defined
# endif
#else

void pure_memzero(void * const pnt, const size_t len)
{
# ifdef HAVE_EXPLICIT_BZERO
    explicit_bzero(pnt, len);
# else
    volatile unsigned char *pnt_ = (volatile unsigned char *) pnt;
    size_t                     i = (size_t) 0U;

    while (i < len) {
        pnt_[i++] = 0U;
    }
# endif
}

int pure_memcmp(const void * const b1_, const void * const b2_, size_t len)
{
    const unsigned char *b1 = (const unsigned char *) b1_;
    const unsigned char *b2 = (const unsigned char *) b2_;
    size_t               i;
    unsigned char        d = (unsigned char) 0U;

    for (i = 0U; i < len; i++) {
        d |= b1[i] ^ b2[i];
    }
    return (int) ((1 & ((d - 1) >> 8)) - 1);
}

#endif

int pure_strcmp(const char * const s1, const char * const s2)
{
    return pure_memcmp(s1, s2, strlen(s1) + 1U);
}


Fixed version (ground truth):

#include <config.h>

#include "ftpd.h"
#include "utils.h"

#ifdef WITH_DMALLOC
# include <dmalloc.h>
#endif

#ifdef HAVE_LIBSODIUM
# if !defined(pure_memzero) || !defined(pure_memcmp)
#  error pure_memzero/pure_memcmp not defined
# endif
#else

void pure_memzero(void * const pnt, const size_t len)
{
# ifdef HAVE_EXPLICIT_BZERO
    explicit_bzero(pnt, len);
# else
    volatile unsigned char *pnt_ = (volatile unsigned char *) pnt;
    size_t                     i = (size_t) 0U;

    while (i < len) {
        pnt_[i++] = 0U;
    }
# endif
}

int pure_memcmp(const void * const b1_, const void * const b2_, size_t len)
{
    const unsigned char *b1 = (const unsigned char *) b1_;
    const unsigned char *b2 = (const unsigned char *) b2_;
    size_t               i;
    unsigned char        d = (unsigned char) 0U;

    for (i = 0U; i < len; i++) {
        d |= b1[i] ^ b2[i];
    }
    return (int) ((1 & ((d - 1) >> 8)) - 1);
}

#endif

int pure_strcmp(const char * const s1, const char * const s2)
{
    const size_t s1_len = strlen(s1);
    const size_t s2_len = strlen(s2);
    const size_t len = (s1_len < s2_len) ? s1_len : s2_len;

    return pure_memcmp(s1, s2, len + 1);
}
Program: CWE-22
Project: CVE-2011-1589
Buggy source:
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More tests => 3;

# "This is the greatest case of false advertising I’ve seen since I sued the
#  movie 'The Never Ending Story.'"
use_ok 'Mojo::Path';

my $path = Mojo::Path->new;
is $path->parse('/path')->to_string,   '/path',   'right path';
is $path->parse('/path/0')->to_string, '/path/0', 'right path';


Fixed version (ground truth):
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More tests => 11;

# "This is the greatest case of false advertising I’ve seen since I sued the
#  movie 'The Never Ending Story.'"
use_ok 'Mojo::Path';

my $path = Mojo::Path->new;
is $path->parse('/path')->to_string,   '/path',   'right path';
is $path->parse('/path/0')->to_string, '/path/0', 'right path';

# Canonicalizing
$path = Mojo::Path->new(
  '/%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd');
is "$path", '/../../../../../../../../../../etc/passwd', 'rigth result';
is $path->parts->[0], '..', 'right part';
is $path->canonicalize, '/../../../../../../../../../../etc/passwd',
  'rigth result';
is $path->parts->[0], '..', 'right part';
$path = Mojo::Path->new(
  '/%2ftest%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd');
is "$path", '/test/../../../../../../../../../etc/passwd', 'rigth result';
is $path->parts->[0], 'test', 'right part';
is $path->canonicalize, '/../../../../../../../../etc/passwd', 'rigth result';
is $path->parts->[0], '..', 'right part';
Program: CWE-22
Project: CVE-2011-4596
Buggy source:
include HACKING LICENSE run_tests.py run_tests.sh
include README exercise_rsapi.py
include MANIFEST.in pylintrc Authors
graft nova/CA
graft doc
graft smoketests
graft tools
graft etc
graft contrib
graft po
graft plugins
graft nova/api/openstack/schemas
include nova/auth/*.schema
include nova/auth/novarc.template
include nova/auth/opendj.sh
include nova/auth/slap.sh
include nova/cloudpipe/bootscript.sh
include nova/cloudpipe/client.ovpn.template
include nova/cloudpipe/bootscript.template
include nova/compute/fakevirtinstance.xml
include nova/compute/interfaces.template
include nova/console/xvp.conf.template
include nova/db/sqlalchemy/migrate_repo/migrate.cfg
include nova/db/sqlalchemy/migrate_repo/README
include nova/db/sqlalchemy/migrate_repo/versions/*.sql
include nova/virt/interfaces.template
include nova/virt/libvirt*.xml.template
include nova/virt/cpuinfo.xml.template
include nova/tests/CA/
include nova/tests/CA/cacert.pem
include nova/tests/CA/private/
include nova/tests/CA/private/cakey.pem
include nova/tests/bundle/
include nova/tests/bundle/1mb.manifest.xml
include nova/tests/bundle/1mb.no_kernel_or_ramdisk.manifest.xml
include nova/tests/bundle/1mb.part.0
include nova/tests/bundle/1mb.part.1
include nova/tests/api/ec2/public_key/*
include nova/tests/db/nova.austin.sqlite
include plugins/xenapi/README
include plugins/xenapi/etc/xapi.d/plugins/objectstore
include plugins/xenapi/etc/xapi.d/plugins/pluginlib_nova.py
global-exclude *.pyc


Fixed version (ground truth):
include HACKING LICENSE run_tests.py run_tests.sh
include README exercise_rsapi.py
include MANIFEST.in pylintrc Authors
graft nova/CA
graft doc
graft smoketests
graft tools
graft etc
graft contrib
graft po
graft plugins
graft nova/api/openstack/schemas
include nova/auth/*.schema
include nova/auth/novarc.template
include nova/auth/opendj.sh
include nova/auth/slap.sh
include nova/cloudpipe/bootscript.sh
include nova/cloudpipe/client.ovpn.template
include nova/cloudpipe/bootscript.template
include nova/compute/fakevirtinstance.xml
include nova/compute/interfaces.template
include nova/console/xvp.conf.template
include nova/db/sqlalchemy/migrate_repo/migrate.cfg
include nova/db/sqlalchemy/migrate_repo/README
include nova/db/sqlalchemy/migrate_repo/versions/*.sql
include nova/virt/interfaces.template
include nova/virt/libvirt*.xml.template
include nova/virt/cpuinfo.xml.template
include nova/tests/CA/
include nova/tests/CA/cacert.pem
include nova/tests/CA/private/
include nova/tests/CA/private/cakey.pem
include nova/tests/bundle/
include nova/tests/bundle/1mb.manifest.xml
include nova/tests/bundle/1mb.no_kernel_or_ramdisk.manifest.xml
include nova/tests/bundle/1mb.part.0
include nova/tests/bundle/1mb.part.1
include nova/tests/api/ec2/public_key/*
include nova/tests/db/nova.austin.sqlite
include nova/tests/image/*.tar.gz
include plugins/xenapi/README
include plugins/xenapi/etc/xapi.d/plugins/objectstore
include plugins/xenapi/etc/xapi.d/plugins/pluginlib_nova.py
global-exclude *.pyc
Program: CWE-22
Project: CVE-2012-2139
Buggy source:
module Mail
  
  # FileDelivery class delivers emails into multiple files based on the destination
  # address.  Each file is appended to if it already exists.
  # 
  # So if you have an email going to fred@test, bob@test, joe@anothertest, and you
  # set your location path to /path/to/mails then FileDelivery will create the directory
  # if it does not exist, and put one copy of the email in three files, called
  # "fred@test", "bob@test" and "joe@anothertest"
  # 
  # Make sure the path you specify with :location is writable by the Ruby process
  # running Mail.
  class FileDelivery

    if RUBY_VERSION >= '1.9.1'
      require 'fileutils'
    else
      require 'ftools'
    end

    def initialize(values)
      self.settings = { :location => './mails' }.merge!(values)
    end
    
    attr_accessor :settings
    
    def deliver!(mail)
      if ::File.respond_to?(:makedirs)
        ::File.makedirs settings[:location]
      else
        ::FileUtils.mkdir_p settings[:location]
      end

      mail.destinations.uniq.each do |to|
        ::File.open(::File.join(settings[:location], to), 'a') { |f| "#{f.write(mail.encoded)}\r\n\r\n" }
      end
    end
    
  end
end


Fixed version (ground truth):
module Mail
  
  # FileDelivery class delivers emails into multiple files based on the destination
  # address.  Each file is appended to if it already exists.
  # 
  # So if you have an email going to fred@test, bob@test, joe@anothertest, and you
  # set your location path to /path/to/mails then FileDelivery will create the directory
  # if it does not exist, and put one copy of the email in three files, called
  # by their message id
  # 
  # Make sure the path you specify with :location is writable by the Ruby process
  # running Mail.
  class FileDelivery

    if RUBY_VERSION >= '1.9.1'
      require 'fileutils'
    else
      require 'ftools'
    end

    def initialize(values)
      self.settings = { :location => './mails' }.merge!(values)
    end
    
    attr_accessor :settings
    
    def deliver!(mail)
      if ::File.respond_to?(:makedirs)
        ::File.makedirs settings[:location]
      else
        ::FileUtils.mkdir_p settings[:location]
      end

      mail.destinations.uniq.each do |to|
        ::File.open(::File.join(settings[:location], File.basename(to.to_s)), 'a') { |f| "#{f.write(mail.encoded)}\r\n\r\n" }
      end
    end
    
  end
end
Program: CWE-22
Project: CVE-2013-4413
Buggy source:
None

Fixed version (ground truth):
require 'test_helper'

class SecurityTest < ActiveSupport::IntegrationCase

  test 'does not show database.yml' do
    step = "%2E%2F%2E%2E%2F%2E%2E%2Fconfig%2Fdatabase%2Eyml"
    assert_raise ActionView::MissingTemplate do
      visit(bar_path(step))
    end
    refute has_content?('sqlite3')
  end

  # only works on *nix systems
  test 'does not show arbitrary system file' do
    root = '%2E%2F%2E' * 100 # root of system
    step = root + '%2Fusr%2Fshare%2Fdict%2Fwords'

    assert_raise ActionView::MissingTemplate do
      visit(bar_path(step))
    end
    refute has_content?('aardvark')
  end
end
Program: CWE-22
Project: CVE-2017-18354
Buggy source:
<my-element></my-element>
<script>
  class MyElement extends HTMLElement {
    constructor() {
      super();

      const shadowRoot = this.attachShadow({mode: 'open'});
      shadowRoot.innerHTML = 'shadow-root' + '-text';
    }
  }
  customElements.define('my-element', MyElement);
</script>


Fixed version (ground truth):
<!--
Copyright 2017 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
<my-element></my-element>
<script>
  class MyElement extends HTMLElement {
    constructor() {
      super();

      const shadowRoot = this.attachShadow({mode: 'open'});
      shadowRoot.innerHTML = 'shadow-root' + '-text';
    }
  }
  customElements.define('my-element', MyElement);
</script>