output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommittedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = fir...
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testMultiPutSameRow() throws Exception { try{ TransactionManager tm = new TransactionManager(hbaseConf); TTable table1 = new TTable(hbaseConf, TEST_TABLE); int num=10; TransactionState t=tm.beginTransaction(); ...
#vulnerable code @Test public void testMultiPutSameRow() throws Exception { try{ TransactionManager tm = new TransactionManager(hbaseConf); TransactionalTable table1 = new TransactionalTable(hbaseConf, TEST_TABLE); int num=10; TransactionState t...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static TSOState getState(TSOServerConfig config){ TSOState returnValue; if(!config.isRecoveryEnabled()){ LOG.warn("Logger is disabled"); returnValue = new TSOState(new TimestampOracle()); } else { BookKeeperSt...
#vulnerable code public static TSOState getState(TSOServerConfig config){ TSOState returnValue; if(config.getZkServers() == null){ LOG.warn("Logger is disabled"); returnValue = new TSOState(new TimestampOracle()); } else { Book...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void commit(Transaction transaction) throws RollbackException, TransactionException { if (LOG.isTraceEnabled()) { LOG.trace("commit " + transaction); } if (transaction.getStatus() != Status.RUNNING) { throw new IllegalArg...
#vulnerable code public void commit(Transaction transaction) throws RollbackException, TransactionException { if (LOG.isTraceEnabled()) { LOG.trace("commit " + transaction); } // Check rollbackOnly status if (transaction.isRollbackOnly()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void runTestWriteWriteConflict() throws Exception { TransactionManager tm = new TransactionManager(hbaseConf); TTable tt = new TTable(hbaseConf, TEST_TABLE); TransactionState t1 = tm.beginTransaction(); LOG.info("Transaction created " +...
#vulnerable code @Test public void runTestWriteWriteConflict() throws Exception { TransactionManager tm = new TransactionManager(hbaseConf); TransactionalTable tt = new TransactionalTable(hbaseConf, TEST_TABLE); TransactionState t1 = tm.beginTransaction(); LOG...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(ne...
#vulnerable code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadP...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeOut = 30_000) public void runTestInterleaveScanWhenATransactionAborts() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.info("Tr...
#vulnerable code @Test(timeOut = 30_000) public void runTestInterleaveScanWhenATransactionAborts() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.in...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeout = 60000) public void testTimestampRequestSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); cli...
#vulnerable code @Test(timeout = 60000) public void testTimestampRequestSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
#vulnerable code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeout = 60000) public void testCommitCanSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clientConf...
#vulnerable code @Test(timeout = 60000) public void testCommitCanSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clie...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(ne...
#vulnerable code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadP...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCrashAfterCommit() throws Exception { CommitTable.Client commitTableClient = spy(getTSO().getCommitTable().getClient().get()); TSOClient client = TSOClient.newBuilder().withConfiguration(getTSO().getClientConfiguration()) ...
#vulnerable code @Test public void testCrashAfterCommit() throws Exception { CommitTable.Client commitTableClient = spy(getTSO().getCommitTable().getClient().get()); TSOClient client = TSOClient.newBuilder().withConfiguration(getTSO().getClientConfiguration()) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void stop() { for (NotificationClient client : clients.values()) { client.stop(); } }
#vulnerable code public void stop() { if (clientThread != null) { clientThread.interrupt(); } } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBasicBehaviour() throws Throwable { HBaseCommitTable commitTable = new HBaseCommitTable(hbaseConf, TEST_TABLE); ListenableFuture<Writer> futureWriter = commitTable.getWriter(); Writer writer = futureWriter.get(); List...
#vulnerable code @Test public void testBasicBehaviour() throws Throwable { HTable table = new HTable(hbaseConf, TEST_TABLE); HBaseCommitTable commitTable = new HBaseCommitTable(table); ListenableFuture<Writer> futureWriter = commitTable.getWriter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
#vulnerable code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws Exception { Config config = new Config(); new JCommander(config, args); Configuration hbaseConfig = HBaseConfiguration.create(); final KeyGenerator keygen; if (config.fullRandomAlgo) { ...
#vulnerable code public static void main(String[] args) throws Exception { Config config = new Config(); new JCommander(config, args); Configuration hbaseConfig = HBaseConfiguration.create(); HTable commitHTable = new HTable(hbaseConfig, COMMIT_TABLE_DEF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeOut = 30_000) public void runTestInterleaveScan() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.info("Transaction created " + ...
#vulnerable code @Test(timeOut = 30_000) public void runTestInterleaveScan() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.info("Transaction create...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public TSOState buildState() throws LoggerException { try{ CountDownLatch latch = new CountDownLatch(1); this.zk = new ZooKeeper(config.getZkServers(), Integer.parseI...
#vulnerable code @Override public TSOState buildState() throws LoggerException { try{ CountDownLatch latch = new CountDownLatch(1); this.zk = new ZooKeeper(config.getZkServers(), Integer....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public byte[] getChannelConfigurationBytes() throws InvalidArgumentException, TransactionException { return getChannelConfigurationBytes(client.getUserContext()); }
#vulnerable code public byte[] getChannelConfigurationBytes() throws TransactionException { try { final Block configBlock = getConfigBlock(getShuffledPeers()); Envelope envelopeRet = Envelope.parseFrom(configBlock.getData().getData(0)); Payl...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Channel reconstructChannel(String name, HFClient client, SampleOrg sampleOrg) throws Exception { out("Reconstructing %s channel", name); client.setUserContext(sampleOrg.getPeerAdmin()); Channel newChannel; if (BAR_CHANNEL_NAME.equals...
#vulnerable code private Channel reconstructChannel(String name, HFClient client, SampleOrg sampleOrg) throws Exception { out("Reconstructing %s channel", name); client.setUserContext(sampleOrg.getPeerAdmin()); Channel newChannel; if (BAR_CHANNEL_NAME....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Orderer(String name, String url, Properties properties) throws InvalidArgumentException { if (StringUtil.isNullOrEmpty(name)) { throw new InvalidArgumentException("Invalid name for orderer"); } Exception e = checkGrpcUrl(url); if (...
#vulnerable code Ab.BroadcastResponse sendTransaction(Common.Envelope transaction) throws Exception { if (shutdown) { throw new TransactionException(format("Orderer %s was shutdown.", name)); } logger.debug(format("Order.sendTransaction name: %s, url...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Peer(String name, String grpcURL, Properties properties) throws InvalidArgumentException { Exception e = checkGrpcUrl(grpcURL); if (e != null) { throw new InvalidArgumentException("Bad peer url.", e); } if (StringUtil.isNullOrEmp...
#vulnerable code ListenableFuture<FabricProposalResponse.ProposalResponse> sendProposalAsync(FabricProposal.SignedProposal proposal) throws PeerException, InvalidArgumentException { checkSendProposal(proposal); logger.debug(format("peer.sendProposalAsync nam...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public byte[] getChannelConfigurationBytes() throws TransactionException { try { final Block configBlock = getConfigBlock(getRandomPeer()); Envelope envelopeRet = Envelope.parseFrom(configBlock.getData().getData(0)); Payload paylo...
#vulnerable code public byte[] getChannelConfigurationBytes() throws TransactionException { try { final Block configBlock = getConfigurationBlock(); Envelope envelopeRet = Envelope.parseFrom(configBlock.getData().getData(0)); Payload payload...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testValidateInvalidCertificate() throws IOException, CertificateException { assertFalse(crypto.validateCertificate(invalidPemCert)); }
#vulnerable code @Test public void testValidateInvalidCertificate() throws IOException, CertificateException { BufferedInputStream pem = new BufferedInputStream(new ByteArrayInputStream(invalidPemCert)); assertFalse(crypto.validateCertificate(invalidPemCert)); }...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void parseConfigBlock() throws TransactionException { try { Block parseFrom = getConfigBlock(getRandomPeer()); // final Block configBlock = getConfigurationBlock(); logger.debug(format("Channel %s Got config block gett...
#vulnerable code protected void parseConfigBlock() throws TransactionException { try { final Block configBlock = getConfigurationBlock(); logger.debug(format("Channel %s Got config block getting MSP data and anchorPeers data", name)); Enve...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean hasConnected() { return connected; }
#vulnerable code void initiateEventing(TransactionContext transactionContext, PeerOptions peersOptions) throws TransactionException { this.transactionContext = transactionContext.retryTransactionSameContext(); if (peerEventingClient == null) { //PeerEventS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code synchronized boolean connect(final TransactionContext transactionContext) throws EventHubException { if (connected) { logger.warn(format("%s already connected.", toString())); return true; } eventStream = null; final Co...
#vulnerable code synchronized boolean connect(final TransactionContext transactionContext) throws EventHubException { if (connected) { logger.warn(format("%s already connected.", toString())); return true; } eventStream = null; fi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean hasConnected() { return connected; }
#vulnerable code void setTLSCertificateKeyPair(TLSCertificateKeyPair tlsCertificateKeyPair) { properties.put("clientKeyBytes", tlsCertificateKeyPair.getKeyPemBytes()); properties.put("clientCertBytes", tlsCertificateKeyPair.getCertPEMBytes()); Endpoint endpoint ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Orderer(String name, String url, Properties properties) throws InvalidArgumentException { if (StringUtil.isNullOrEmpty(name)) { throw new InvalidArgumentException("Invalid name for orderer"); } Exception e = checkGrpcUrl(url); if (...
#vulnerable code DeliverResponse[] sendDeliver(Common.Envelope transaction) throws TransactionException { if (shutdown) { throw new TransactionException(format("Orderer %s was shutdown.", name)); } OrdererClient localOrdererClient = ordererClient; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException { updateChannelConfiguration(client.getUserContext(), updateChannelConfiguration, or...
#vulnerable code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException { checkChannelState(); checkOrderer(orderer); try { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGetInfo() throws Exception { if (testConfig.isRunningAgainstFabric10()) { HFCAInfo info = client.info(); assertNull(info.getVersion()); } if (!testConfig.isRunningAgainstFabric10()) { HFCA...
#vulnerable code @Test public void testGetInfo() throws Exception { if (testConfig.isRunningAgainstFabric10()) { HFCAInfo info = client.info(); assertNull(info.getVersion()); } if (!testConfig.isRunningAgainstFabric10()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code PeerEventServiceClient(Peer peer, Endpoint endpoint, Properties properties, PeerOptions peerOptions) { this.channelBuilder = endpoint.getChannelBuilder(); this.filterBlock = peerOptions.isRegisterEventsForFilteredBlocks(); this.peer = peer; na...
#vulnerable code void connectEnvelope(Envelope envelope) throws TransactionException { if (shutdown) { logger.warn(format("Peer %s not connecting is shutdown ", peer)); return; } ManagedChannel lmanagedChannel = managedChannel; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code TBSCertList.CRLEntry[] getRevokes(Date r) throws Exception { String crl = client.generateCRL(admin, r, null, null, null); return parseCRL(crl); }
#vulnerable code TBSCertList.CRLEntry[] parseCRL(String crl) throws Exception { Base64.Decoder b64dec = Base64.getDecoder(); final byte[] decode = b64dec.decode(crl.getBytes(UTF_8)); ByteArrayInputStream inStream = new ByteArrayInputStream(decode); ASN1...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Orderer(String name, String url, Properties properties) throws InvalidArgumentException { if (StringUtil.isNullOrEmpty(name)) { throw new InvalidArgumentException("Invalid name for orderer"); } Exception e = checkGrpcUrl(url); if (...
#vulnerable code DeliverResponse[] sendDeliver(Common.Envelope transaction) throws TransactionException { if (shutdown) { throw new TransactionException(format("Orderer %s was shutdown.", name)); } OrdererClient localOrdererClient = ordererClient; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException { updateChannelConfiguration(client.getUserContext(), updateChannelConfiguration, getRandomOrderer()...
#vulnerable code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException { updateChannelConfiguration(updateChannelConfiguration, getRandomOrderer(), signers); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean hasConnected() { return connected; }
#vulnerable code void setTLSCertificateKeyPair(TLSCertificateKeyPair tlsCertificateKeyPair) { properties.put("clientKeyBytes", tlsCertificateKeyPair.getKeyPemBytes()); properties.put("clientCertBytes", tlsCertificateKeyPair.getCertPEMBytes()); Endpoint endpoint ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code TBSCertList.CRLEntry[] getRevokes(Date r) throws Exception { String crl = client.generateCRL(admin, r, null, null, null); return parseCRL(crl); }
#vulnerable code TBSCertList.CRLEntry[] getRevokes(Date r) throws Exception { String crl = client.generateCRL(admin, r, null, null, null); Base64.Decoder b64dec = Base64.getDecoder(); final byte[] decode = b64dec.decode(crl.getBytes(UTF_8)); ByteArrayI...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean hasConnected() { return connected; }
#vulnerable code void setProperties(Properties properties) { this.properties = properties; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code ServiceDiscovery(Channel channel, Collection<Peer> serviceDiscoveryPeers, TransactionContext transactionContext) { this.serviceDiscoveryPeers = serviceDiscoveryPeers; this.channel = channel; this.channelName = channel.getName(); this.transactio...
#vulnerable code Map<String, SDChaindcode> discoverEndorserEndpoints(TransactionContext transactionContext, List<List<ServiceDiscoveryChaincodeCalls>> chaincodeNames) throws ServiceDiscoveryException { if (null == chaincodeNames) { logger.warn("Discover of chaincode ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Peer(String name, String grpcURL, Properties properties) throws InvalidArgumentException { Exception e = checkGrpcUrl(grpcURL); if (e != null) { throw new InvalidArgumentException("Bad peer url.", e); } if (StringUtil.isNullOrEmp...
#vulnerable code FabricProposalResponse.ProposalResponse sendProposal(FabricProposal.SignedProposal proposal) throws PeerException, InvalidArgumentException { checkSendProposal(proposal); logger.debug(format("peer.sendProposalAsync name: %s, url: %s", name, ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static final Collection<MapArea> createAreasForSimpleMultipolygon(OsmRelation relation, TLongObjectMap<MapNode> nodeIdMap, OsmEntityProvider db) throws EntityNotFoundException { assert isSimpleMultipolygon(relation, db); OsmEntity tagSource = null; List<MapNod...
#vulnerable code private static final Collection<MapArea> createAreasForSimpleMultipolygon(OsmRelation relation, TLongObjectMap<MapNode> nodeIdMap, OsmEntityProvider db) throws EntityNotFoundException { assert isSimpleMultipolygon(relation, db); OsmEntity tagSource = null; List<...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] unparsedArgs) { /* assume --gui if no parameters are given */ if (unparsedArgs.length == 0) { System.out.println("No parameters, running graphical interface.\n" + "If you want to use the command line, use the --help" + ...
#vulnerable code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void addPrimitiveToValueBuffer(BufferT buffer, Primitive primitive) { /* * rearrange the lists of vertices, normals and texture coordinates * to turn triangle strips and triangle fans into separate triangles */ List<VectorXYZ> primVert...
#vulnerable code @Override protected void addPrimitiveToValueBuffer(BufferT buffer, Primitive primitive) { /* * rearrange the lists of vertices, normals and texture coordinates * to turn triangle strips and triangle fans into separate triangles */ List<VectorXYZ> pr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } catch ...
#vulnerable code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } catch (ArgumentValidationException e) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void beginObject(WorldObject object) { finishCurrentObject(); /* start a new object */ currentObject = object; currentTriangles = new HashMap<Material, FrontendPbfTarget.TriangleData>(); }
#vulnerable code @Override public void beginObject(WorldObject object) { /* build the previous object (if it's inside the bounding box) */ boolean isInsideBbox = true; if (currentObject != null && currentObject.getPrimaryMapElement() != null) { MapElement mapElement = current...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")...
#vulnerable code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='J...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static int createFragmentShader(GL3 gl, String filename) { int fragShader = gl.glCreateShader(GL3.GL_FRAGMENT_SHADER); if (fragShader == 0) return 0; String[] fragCode = new String[1]; fragCode[0] = ""; String line; InputStream stream = loadShaderFile(fi...
#vulnerable code public static int createFragmentShader(GL3 gl, String filename) { int fragShader = gl.glCreateShader(GL3.GL_FRAGMENT_SHADER); if (fragShader == 0) return 0; String[] fragCode = new String[1]; fragCode[0] = ""; String line; InputStream stream = loadShaderF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void createComponents(){ for (MapElement element : elements){ IndoorObjectData data = new IndoorObjectData(buildingPart, element); switch (element.getTags().getValue("indoor")){ case "wall": wall...
#vulnerable code private void createComponents(){ for (MapElement element : elements){ switch (element.getTags().getValue("indoor")){ case "wall": walls.add(new IndoorWall(buildingPart, element)); break; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static final boolean isJOSMGenerated(File file) { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) { r...
#vulnerable code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static final List<String[]> getUnparsedParameterGroups( File parameterFile) throws IOException { try (BufferedReader in = new BufferedReader(new FileReader(parameterFile))) { List<String[]> result = new ArrayList<>(); String line; while ((line = in.readL...
#vulnerable code public static final List<String[]> getUnparsedParameterGroups( File parameterFile) throws IOException { List<String[]> result = new ArrayList<String[]>(); BufferedReader in = new BufferedReader(new FileReader(parameterFile)); String line; while ((line = in.r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static final boolean isJOSMGenerated(File file) { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) { r...
#vulnerable code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } catch ...
#vulnerable code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void slaveDown(ClusterSlotRange slotRange, String host, int port) { MasterSlaveEntry entry = getEntry(slotRange); slaveDown(entry, host, port); }
#vulnerable code protected void slaveDown(ClusterSlotRange slotRange, String host, int port) { Collection<RedisPubSubConnection> allPubSubConnections = getEntry(slotRange).slaveDown(host, port); // reattach listeners to other channels for (Entry<String, PubSubCo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean compareAndSet(long expect, long update) { RedisConnection<String, Object> conn = connectionManager.connection(); try { while (true) { conn.watch(getName()); Long value = ((Number) conn.ge...
#vulnerable code @Override public boolean compareAndSet(long expect, long update) { RedisConnection<String, Object> conn = connectionManager.connection(); try { while (true) { conn.watch(getName()); Long value = (Long) conn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean remove(Object o) { return remove(o, 1); }
#vulnerable code @Override public boolean remove(Object o) { RedisConnection<String, Object> connection = connectionManager.connectionWriteOp(); try { return connection.lrem(getName(), 1, o) > 0; } finally { connectionManager.release(c...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReplaceDepartments(){ List<Department> departments = Departments.defaultDepartments().list(); File tmpDir = Files.createTempDir(); File groups = new File(tmpDir, "departments.csv"); try { PrintWriter grou...
#vulnerable code @Test public void testReplaceDepartments(){ List<Department> departments = Departments.defaultDepartments().list(); File tmpDir = Files.createTempDir(); File groups = new File(tmpDir, "departments.csv"); try { PrintWrite...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReplaceUsers(){ List<ReadUser> allUsers = Users.defaultUsers().list(); File tmpDir = Files.createTempDir(); File users = new File(tmpDir, "users.csv"); try { PrintWriter userPrintWriter = new PrintWriter(...
#vulnerable code @Test public void testReplaceUsers(){ List<ReadUser> allUsers = Users.defaultUsers().list(); File tmpDir = Files.createTempDir(); File users = new File(tmpDir, "users.csv"); try { PrintWriter userPrintWriter = new PrintW...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadMainDict() { // 建立一个主词典实例 _MainDict = new DictSegment((char) 0); // 读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new Runtime...
#vulnerable code private void loadMainDict() { //建立一个主词典实例 _MainDict = new DictSegment((char) 0); //读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new Run...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream is; ...
#vulnerable code private void loadStopWordDict() { //建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); //加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream i...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static UpdateKeeper getInstance() { return UpdateKeeper.Builder.singleton; }
#vulnerable code static UpdateKeeper getInstance() { if (singleton == null) { synchronized (UpdateKeeper.class) { if (singleton == null) { singleton = new UpdateKeeper(); return singleton; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 Syst...
#vulnerable code private void loadExtDict() { //加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { //读取扩展词典文件 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadQuantifierDict() { // 建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); // 读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
#vulnerable code private void loadQuantifierDict() { // 建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); // 读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream is; ...
#vulnerable code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadQuantifierDict() { // 建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); // 读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
#vulnerable code private void loadQuantifierDict() { //建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); //读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 Syst...
#vulnerable code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void reloadDic(List<InputStream> inputStreamList) { // 如果本类单例尚未实例化,则先进行初始化操作 if (singleton == null) { Configuration cfg = DefaultConfig.getInstance(); initial(cfg); } // 对词典流集合进行循环读取,将读取到的词语加载到主词典中 ...
#vulnerable code public static void reloadDic(List<InputStream> inputStreamList) { if (singleton == null) { Configuration cfg = DefaultConfig.getInstance(); initial(cfg); } for (InputStream is : inputStreamList) { try { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<DiscoveryNode> buildDynamicNodes() { if (refreshInterval.millis() != 0) { if (cachedDiscoNodes != null && (refreshInterval.millis() < 0 || (System.currentTimeMillis() - lastRefresh) < refreshInterval.millis()))...
#vulnerable code @Override public List<DiscoveryNode> buildDynamicNodes() { if (refreshInterval.millis() != 0) { if (cachedDiscoNodes != null && (refreshInterval.millis() < 0 || (System.currentTimeMillis() - lastRefresh) < refreshInterval.mill...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void harvest(IceMediaStream mediaStream, PortManager portManager, Selector selector) throws HarvestException, NoCandidatesGatheredException { // Ask each harvester to gather candidates for the media stream // HOST candidates take precedence and are mandatory Candida...
#vulnerable code public void harvest(IceMediaStream mediaStream, PortManager portManager, Selector selector) throws HarvestException, NoCandidatesGatheredException { // Safe copy of currently registered harvesters Map<CandidateType, CandidateHarvester> copy; synchronized (this.harves...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void leaveRtpSession() { if (this.joined.get()) { this.joined.set(false); /* * When the participant decides to leave the system, tp is reset to tc, the current time, members and pmembers are * initialized to 1,...
#vulnerable code public void leaveRtpSession() { if (this.joined.get()) { this.joined.set(false); /* * When the participant decides to leave the system, tp is reset to tc, the current time, members and pmembers are * initialized...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCodec() throws Exception { boolean testPassed = false; try { OpusJni opus = new OpusJni(); opus.initNative(); final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); ...
#vulnerable code @Test public void testCodec() throws Exception { boolean testPassed = false; try { final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); FileInputStream inputStream = new FileInputStream("sr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void harvest(IceMediaStream mediaStream, PortManager portManager, Selector selector) throws HarvestException, NoCandidatesGatheredException { // Ask each harvester to gather candidates for the media stream // HOST candidates take precedence and are mandatory Candida...
#vulnerable code public void harvest(IceMediaStream mediaStream, PortManager portManager, Selector selector) throws HarvestException, NoCandidatesGatheredException { // Safe copy of currently registered harvesters Map<CandidateType, CandidateHarvester> copy; synchronized (this.harves...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Frame read(long timestamp) { try { LOCK.lock(); if (queue.size() == 0) { this.ready = false; return null; } //extract packet Frame frame = queue.remove(0); //buffer empty now? - change ready flag. if (queue.size() == 0) { this.read...
#vulnerable code public Frame read(long timestamp) { try { if (queue.size() == 0) { this.ready = false; return null; } //extract packet Frame frame = queue.remove(0); //buffer empty now? - change ready flag. if (queue.size() == 0) { this.ready = false;...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public String open(String sdp) throws MgcpConnectionException { synchronized (this.stateLock) { switch (this.state) { case CLOSED: case HALF_OPEN: // Update state this.st...
#vulnerable code @Override public String open(String sdp) throws MgcpConnectionException { synchronized (this.stateLock) { switch (this.state) { case CLOSED: case HALF_OPEN: // Update state t...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCodec() throws Exception { boolean testPassed = false; try { OpusJni opus = new OpusJni(); opus.initNative(); final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); ...
#vulnerable code @Test public void testCodec() throws Exception { boolean testPassed = false; try { final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); FileInputStream inputStream = new FileInputStream("sr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Frame read(long timestamp) { try { LOCK.lock(); if (queue.size() == 0) { this.ready = false; return null; } //extract packet Frame frame = queue.remove(0); //buffer empty now? - change ready flag. if (queue.size() == 0) { this.read...
#vulnerable code public Frame read(long timestamp) { try { if (queue.size() == 0) { this.ready = false; return null; } //extract packet Frame frame = queue.remove(0); //buffer empty now? - change ready flag. if (queue.size() == 0) { this.ready = false;...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void stop() { while (buffer.size() > 0) { Frame frame = buffer.poll(); if(frame != null) { frame.recycle(); } } super.stop(); }
#vulnerable code @Override public void stop() { while (buffer.size() > 0) { buffer.poll().recycle(); } super.stop(); } #location 4 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private byte[] processRequest(StunRequest request, InetSocketAddress localPeer, InetSocketAddress remotePeer) throws IOException { /* * The agent MUST use a short-term credential to authenticate the * request and perform a message integrity check. */ // Produce Bin...
#vulnerable code private byte[] processRequest(StunRequest request, InetSocketAddress localPeer, InetSocketAddress remotePeer) throws IOException { /* * The agent MUST use a short-term credential to authenticate the * request and perform a message integrity check. */ // Produ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void train(String dataFile, int maxite, float c) throws IOException { fp = File.createTempFile("train-features", null, new File("./tmp/")); buildInstanceList(dataFile); LabelAlphabet postagAlphabet = factory.buildLabelAlphabet("postag"); SFGenerator generator...
#vulnerable code public void train(String dataFile, int maxite, float c) throws IOException { fp = File.createTempFile("train-features", null, new File("./tmp/")); buildInstanceList(dataFile); LabelAlphabet postagAlphabet = factory.buildLabelAlphabet("postag"); IFeatureAlphabet...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { try { String ls_1; Process process =null; // File handle = new File("../tmp/ctb_v1/data"); File handle = new File("../tmp/ctb_v6/data/bracketed"); BufferedWriter bout = new BufferedWriter(new OutputStreamWriter( ...
#vulnerable code public static void main(String[] args) { try { String ls_1; Process process =null; File handle = new File("./tmpdata/ctb/data3"); BufferedWriter bout = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("./tmpdata/malt.train"), "UTF-8"));...
Below is the vulnerable code, please generate the patch based on the following information.