input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code @Test void shouldAutoEnableCaching() { AnnotationConfigApplicationContext context = setup(""); assertThat(context.getBeansOfType(CacheManager.class)).isNotEmpty(); assertThat(context.getBeansOfType(CacheManager.class).get("cacheManager")) .isNotInstanceOf(NoOpCa...
#fixed code @Test void shouldAutoEnableCaching() { ApplicationContextRunner contextRunner = baseApplicationRunner(); contextRunner.run(context -> { assertThat(context.getBeansOfType(CacheManager.class)).hasSize(1); assertThat(((CacheManager) context.getBean("loadBalancerCacheMan...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void newConnectionManagerWithTTL() throws Exception { HttpClientConnectionManager connectionManager = new DefaultApacheHttpClientConnectionManagerFactory() .newConnectionManager(false, 2, 6, 56L, TimeUnit.DAYS, null); then(((PoolingHttpClientConnectio...
#fixed code @Test public void newConnectionManagerWithTTL() { HttpClientConnectionManager connectionManager = new DefaultApacheHttpClientConnectionManagerFactory() .newConnectionManager(false, 2, 6, 56L, TimeUnit.DAYS, null); then(((PoolingHttpClientConnectionManager) connectionMan...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @ManagedOperation public boolean rebind(String name) { if (!this.beans.getBeanNames().contains(name)) { return false; } if (this.applicationContext != null) { try { Object bean = this.applicationContext.getBean(name); if (AopUtils.isAopProxy(bean)) { ...
#fixed code @ManagedOperation public boolean rebind(String name) { if (!this.beans.getBeanNames().contains(name)) { return false; } if (this.applicationContext != null) { try { Object bean = this.applicationContext.getBean(name); if (AopUtils.isAopProxy(bean)) { be...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void newConnectionManager() throws Exception { HttpClientConnectionManager connectionManager = new DefaultApacheHttpClientConnectionManagerFactory() .newConnectionManager(false, 2, 6); then(((PoolingHttpClientConnectionManager) connectionManager) ...
#fixed code @Test public void newConnectionManager() { HttpClientConnectionManager connectionManager = new DefaultApacheHttpClientConnectionManagerFactory() .newConnectionManager(false, 2, 6); then(((PoolingHttpClientConnectionManager) connectionManager) .getDefaultMaxPerRoute(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public HostInfo convertAddress(final InetAddress address) { HostInfo hostInfo = new HostInfo(); Future<String> result = getExecutor().submit(new Callable<String>() { @Override public String call() throws Exception { return address.getHostName(); } }); ...
#fixed code public HostInfo convertAddress(final InetAddress address) { HostInfo hostInfo = new HostInfo(); Future<String> result = executorService.submit(new Callable<String>() { @Override public String call() throws Exception { return address.getHostName(); } }); Str...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void receive(DatagramPacket p) throws IOException { synchronized (inReceiveSyncRoot) { inReceive++; } try { super.receive(p); } finally { ...
#fixed code @Override public void receive(DatagramPacket p) throws IOException { final Lock receiveLock = receiveCloseLock.readLock(); receiveLock.lock(); try { super.receive(p); } finally { r...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); //stop responding to ...
#fixed code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); // cancel termination timer...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void validateRequestAttributes(StunMessageEvent evt) throws IllegalArgumentException, StunException, IOException { Message request = evt.getMessage(); //assert valid username UsernameAttribute unameAttr = (UsernameAttribute)r...
#fixed code private void validateRequestAttributes(StunMessageEvent evt) throws IllegalArgumentException, StunException, IOException { Message request = evt.getMessage(); //assert valid username UsernameAttribute unameAttr = (UsernameAttribute)request...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static String[] getBlockedInterfaces() { if (!interfaceFiltersinitialized) { try { initializeInterfaceFilters(); } catch (Exception e) { logger.log(Level.W...
#fixed code public static String[] getBlockedInterfaces() { if (!interfaceFiltersInitialized) { try { initializeInterfaceFilters(); } catch (Exception e) { logger.log(Level.WARNING...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean hasRequestListeners(TransportAddress localAddr) { synchronized(requestListeners) { if(!requestListeners.isEmpty()) { // there is a generic listener return true; } ...
#fixed code public boolean hasRequestListeners(TransportAddress localAddr) { synchronized(requestListeners) { if(!requestListeners.isEmpty()) { // there is a generic listener return true; } } ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void free() { synchronized (localCandidates) { /* * Since the sockets of the non-HostCandidate LocalCandidates may * depend on the socket of the HostCandidate for which they have * been har...
#fixed code protected void free() { synchronized (localCandidates) { /* * Since the sockets of the non-HostCandidate LocalCandidates may * depend on the socket of the HostCandidate for which they have * been harvested...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static String[] getAllowedInterfaces(){ if (!interfaceFiltersinitialized) { try { initializeInterfaceFilters(); } catch (Exception e) { logger.log(Level.WA...
#fixed code public static String[] getAllowedInterfaces(){ if (!interfaceFiltersInitialized) { try { initializeInterfaceFilters(); } catch (Exception e) { logger.log(Level.WARNING,...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void incomingCheckReceived(TransportAddress remoteAddress, TransportAddress localAddress, long priority, String rem...
#fixed code protected void incomingCheckReceived(TransportAddress remoteAddress, TransportAddress localAddress, long priority, String remoteUFr...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); // cancel termination...
#fixed code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). stunKeepAliveRunner.cancel(); // cancel termination timer in case agent is freed // before termin...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); //stop responding to ...
#fixed code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); // cancel termination timer...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void checkListStatesUpdated() { boolean allListsEnded = true; boolean atLeastOneListSucceeded = false; if (getState().isEstablished()) { return; } List<IceMediaStream> streams = getStreams(); ...
#fixed code protected void checkListStatesUpdated() { boolean allListsEnded = true; boolean atLeastOneListSucceeded = false; if (getState().isEstablished()) { return; } List<IceMediaStream> streams = getStreams(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void checkListStatesUpdated() { boolean allListsEnded = true; boolean atLeastOneListSucceeded = false; if(getState() == IceProcessingState.COMPLETED) return; List<IceMediaStream> streams = getStreams(); ...
#fixed code protected void checkListStatesUpdated() { boolean allListsEnded = true; boolean atLeastOneListSucceeded = false; if(getState() == IceProcessingState.COMPLETED) return; List<IceMediaStream> streams = getStreams(); for(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void cancel() { cancel(false); } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code void sendRequest() throws IllegalArgumentException, IOException { logger.fine( "sending STUN " + " tid " + transactionID + " from " + localAddress + " to " + requestDestination); sendRequest0(); this.ret...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); //stop responding to ...
#fixed code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); // cancel termination timer...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void checkListStatesUpdated() { boolean allListsEnded = true; boolean atLeastOneListSucceeded = false; if (getState().isEstablished()) { return; } List<IceMediaStream> streams = getStreams(); ...
#fixed code protected void checkListStatesUpdated() { boolean allListsEnded = true; boolean atLeastOneListSucceeded = false; if (getState().isEstablished()) { return; } List<IceMediaStream> streams = getStreams(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void free() { synchronized (localCandidates) { /* * Since the sockets of the non-HostCandidate LocalCandidates may * depend on the socket of the HostCandidate for which they have * been har...
#fixed code protected void free() { synchronized (localCandidates) { /* * Since the sockets of the non-HostCandidate LocalCandidates may * depend on the socket of the HostCandidate for which they have * been harvested...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public boolean equals(Object obj) throws NullPointerException { if(obj == this) return true; if( ! (obj instanceof Candidate)) return false; Candidate<?> targetCandidate = (Candidate<?>) obj; ...
#fixed code @Override public boolean equals(Object obj) throws NullPointerException { if (obj == this) return true; if (! (obj instanceof Candidate)) return false; Candidate<?> candidate = (Candidate<?>) obj; //co...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void cancel(boolean waitForResponse) { // XXX The cancelled field is initialized to false and then the one and // only write access to it is here to set it to true. The rest of the // code just checks whether it has become true. Consequently,...
#fixed code void sendRequest() throws IllegalArgumentException, IOException { logger.fine( "sending STUN " + " tid " + transactionID + " from " + localAddress + " to " + requestDestination); sendRequest0(); this.ret...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); //stop responding to ...
#fixed code public void free() { logger.fine("Free ICE agent"); shutdown = true; //stop sending keep alives (STUN Binding Indications). if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); // cancel termination timer...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean isOver() { return state == IceProcessingState.COMPLETED || state == IceProcessingState.TERMINATED || state == IceProcessingState.FAILED; } #location 3 #vulne...
#fixed code public boolean isOver() { IceProcessingState state = getState(); return (state != null) && state.isOver(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void sendRequest() throws IllegalArgumentException, IOException { logger.fine( "sending STUN " + " tid " + transactionID + " from " + localAddress + " to " + requestDestination); sendRequest0(); re...
#fixed code void sendRequest() throws IllegalArgumentException, IOException { logger.fine( "sending STUN " + " tid " + transactionID + " from " + localAddress + " to " + requestDestination); sendRequest0(); this.ret...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void run() { retransmissionsThread.setName("ice4j.ClientTransaction"); nextWaitInterval = originalWaitInterval; for (retransmissionCounter = 0; retransmissionCounter < maxRetransmissions; retransmissionCounte...
#fixed code public void run() { retransmissionsThread.setName("ice4j.ClientTransaction"); nextWaitInterval = originalWaitInterval; synchronized(this) { for (retransmissionCounter = 0; retransmissionCounter < maxRetransmiss...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private static void assertSigned(File outFolder, List<File> uApks) throws Exception { assertNotNull(outFolder); File[] outFiles = outFolder.listFiles(); assertNotNull(outFiles); assertEquals("should be same count of apks in out folder", u...
#fixed code private static void assertSigned(File outFolder, List<File> uApks) throws Exception { assertNotNull(outFolder); File[] outFiles = outFolder.listFiles(pathname -> FileUtil.getFileExtension(pathname).toLowerCase().equals("apk")); System.out.println("Foun...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testResign() throws Exception { copyToTestPath(originalFolder, Collections.singletonList(singedApks.get(0))); File signedApk = originalFolder.listFiles()[0]; String cmd = "-" + CLIParser.ARG_APK_FILE + " " + signedApk.getAb...
#fixed code @Test public void testResign() throws Exception { List<File> signedApks = copyToTestPath(originalFolder, Collections.singletonList(singedApks.get(0))); File signedApk = signedApks.get(0); String cmd = "-" + CLIParser.ARG_APK_FILE + " " + signedApk...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Expression parseTildeExpression() { tokens.consume(TILDE); int major = intOf(tokens.consume(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return new GreaterOrEqual(versionOf(major, 0, 0)); } tokens.co...
#fixed code private Expression parseTildeExpression() { consumeNextToken(TILDE); int major = intOf(consumeNextToken(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return new GreaterOrEqual(versionOf(major, 0, 0)); } consumeNext...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Expression parseVersionExpression() { int major = intOf(tokens.consume(NUMERIC).lexeme); tokens.consume(DOT); if (tokens.positiveLookahead(STAR)) { tokens.consume(); return new And( new GreaterOrEqu...
#fixed code private Expression parseVersionExpression() { int major = intOf(consumeNextToken(NUMERIC).lexeme); consumeNextToken(DOT); if (tokens.positiveLookahead(STAR)) { tokens.consume(); return new And( new GreaterOrEqual...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void checkForLeadingZeroes() { Character la1 = chars.lookahead(1); Character la2 = chars.lookahead(2); if (la1 == '0' && DIGIT.isMatchedBy(la2)) { throw new ParseException( "Numeric identifier MUST NOT contain ...
#fixed code private void checkForLeadingZeroes() { Character la1 = chars.lookahead(1); Character la2 = chars.lookahead(2); if (la1 != null && la1 == '0' && DIGIT.isMatchedBy(la2)) { throw new ParseException( "Numeric identifier MUST NOT...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Expression parseTildeExpression() { tokens.consume(TILDE); int major = intOf(tokens.consume(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return new GreaterOrEqual(versionOf(major, 0, 0)); } tokens.co...
#fixed code private Expression parseTildeExpression() { consumeNextToken(TILDE); int major = intOf(consumeNextToken(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return new GreaterOrEqual(versionOf(major, 0, 0)); } consumeNext...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Version parseVersion() { int major = intOf(tokens.consume(NUMERIC).lexeme); int minor = 0; if (tokens.positiveLookahead(DOT)) { tokens.consume(); minor = intOf(tokens.consume(NUMERIC).lexeme); } int...
#fixed code private Version parseVersion() { int major = intOf(consumeNextToken(NUMERIC).lexeme); int minor = 0; if (tokens.positiveLookahead(DOT)) { tokens.consume(); minor = intOf(consumeNextToken(NUMERIC).lexeme); } int p...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Version parseVersion() { int major = intOf(tokens.consume(NUMERIC).lexeme); int minor = 0; if (tokens.positiveLookahead(DOT)) { tokens.consume(); minor = intOf(tokens.consume(NUMERIC).lexeme); } int...
#fixed code private Version parseVersion() { int major = intOf(consumeNextToken(NUMERIC).lexeme); int minor = 0; if (tokens.positiveLookahead(DOT)) { tokens.consume(); minor = intOf(consumeNextToken(NUMERIC).lexeme); } int p...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Expression parseVersionExpression() { int major = intOf(tokens.consume(NUMERIC).lexeme); tokens.consume(DOT); if (tokens.positiveLookahead(STAR)) { tokens.consume(); return new And( new GreaterOrEqu...
#fixed code private Expression parseVersionExpression() { int major = intOf(consumeNextToken(NUMERIC).lexeme); consumeNextToken(DOT); if (tokens.positiveLookahead(STAR)) { tokens.consume(); return new And( new GreaterOrEqual...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Version parseVersion() { int major = intOf(tokens.consume(NUMERIC).lexeme); int minor = 0; if (tokens.positiveLookahead(DOT)) { tokens.consume(); minor = intOf(tokens.consume(NUMERIC).lexeme); } int...
#fixed code private Version parseVersion() { int major = intOf(consumeNextToken(NUMERIC).lexeme); int minor = 0; if (tokens.positiveLookahead(DOT)) { tokens.consume(); minor = intOf(consumeNextToken(NUMERIC).lexeme); } int p...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Expression parseTildeExpression() { tokens.consume(TILDE); int major = intOf(tokens.consume(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return new GreaterOrEqual(versionOf(major, 0, 0)); } tokens.co...
#fixed code private Expression parseTildeExpression() { consumeNextToken(TILDE); int major = intOf(consumeNextToken(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return new GreaterOrEqual(versionOf(major, 0, 0)); } consumeNext...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @RequestMapping(value = { "/{uid}" }) public ModelAndView index(@PathVariable String uid, HttpServletRequest request) { ModelAndView modelAndView = new ModelAndView("report/chart"); try { ReportingPo po = reportingService.getByUid(uid); Map<String, Object> buil...
#fixed code @RequestMapping(value = { "/{uid}" }) public ModelAndView index(@PathVariable String uid, HttpServletRequest request) { ModelAndView modelAndView = new ModelAndView("report/chart"); try { ReportingUtils.previewByTemplate(uid, modelAndView, new EasyUIQueryFormView(), req...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } CipherParameters cipherParameters = null; if (isEncrypt) { cipherParameters = getCipherParameters(iv); try { encCipher = getCipher(isEncrypt); } catch (InvalidAlgo...
#fixed code protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } CipherParameters cipherParameters = null; if (isEncrypt) { cipherParameters = getCipherParameters(iv); try { encCipher = getCipher(isEncrypt); } catch (InvalidAlgorithmP...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } if (isEncrypt) { try { _encryptIV = new byte[_ivLength]; System.arraycopy(iv, 0, _encryptIV, 0, _ivLength); encCipher = getCipher(isEncrypt); ParametersWithIV ...
#fixed code protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } CipherParameters cipherParameters = null; if (isEncrypt) { cipherParameters = getCipherParameters(iv); try { encCipher = getCipher(isEncrypt); } catch (InvalidAlgorithmP...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } if (isEncrypt) { try { _encryptIV = new byte[_ivLength]; System.arraycopy(iv, 0, _encryptIV, 0, _ivLength); encCipher = getCipher(isEncrypt); ParametersWithIV ...
#fixed code protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } CipherParameters cipherParameters = null; if (isEncrypt) { cipherParameters = getCipherParameters(iv); try { encCipher = getCipher(isEncrypt); } catch (InvalidAlgorithmP...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static String exec(String cmd) throws IOException { Process process = Runtime.getRuntime().exec(cmd); InputStream inputStream = process.getInputStream(); InputStream errorStream = process.getErrorStream(); try { String ...
#fixed code public static String exec(String cmd) throws IOException { CommandLine cmdLine = CommandLine.parse(cmd); DefaultExecutor executor = new DefaultExecutor(); // 防止抛出异常 executor.setExitValues(null); // 命令执行的超时时间 ExecuteWatchdog watchdog = new ExecuteWatchdog(600000)...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testIgnoringNonBase64InDecode() throws Exception { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGU...
#fixed code @Test public void testIgnoringNonBase64InDecode() throws Exception { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6e...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test @Ignore public void testCodec130() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Base64OutputStream base64os = new Base64OutputStream(bos); base64os.write(STRING_FIXTURE.getBytes()); ByteArr...
#fixed code @Test @Ignore public void testCodec130() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Base64OutputStream base64os = new Base64OutputStream(bos); base64os.write(StringUtils.getBytesUtf8(STRING_FIXTURE)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); // due to CODEC-130, skip now skips corre...
#fixed code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); // due to CODEC-130, skip now skips correctly d...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testBase64() { String content = "Hello World"; String encodedContent; byte[] encodedBytes = Base64.encodeBase64(StringUtils.getBytesUtf8(content)); encodedContent = StringUtils.newStringUtf8(encodedBytes); assertTrue("...
#fixed code public void testBase64() { String content = "Hello World"; String encodedContent; byte[] encodedBytes = Base64.encodeBase64(StringUtils.getBytesUtf8(content)); encodedContent = StringUtils.newStringUtf8(encodedBytes); assertTrue("encodi...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testDecodePadMarkerIndex3() { assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes()))); assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes()))); } #location 2 ...
#fixed code public void testDecodePadMarkerIndex3() throws UnsupportedEncodingException { assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes("UTF-8")))); assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes("UTF-8")))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testWriteOutOfBounds() throws Exception { byte[] buf = new byte[1024]; ByteArrayOutputStream bout = new ByteArrayOutputStream(); Base64OutputStream out = new Base64OutputStream(bout); try { out.write(buf, -1, 0); ...
#fixed code public void testWriteOutOfBounds() throws Exception { byte[] buf = new byte[1024]; ByteArrayOutputStream bout = new ByteArrayOutputStream(); Base64OutputStream out = new Base64OutputStream(bout); try { out.write(buf, -1, 1); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test @Ignore public void testCodec130() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Base64OutputStream base64os = new Base64OutputStream(bos); base64os.write(STRING_FIXTURE.getBytes()); ByteArr...
#fixed code @Test @Ignore public void testCodec130() throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Base64OutputStream base64os = new Base64OutputStream(bos); base64os.write(StringUtils.getBytesUtf8(STRING_FIXTURE)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReadOutOfBounds() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); byte[] buf = new byte[1024]; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base32Inpu...
#fixed code @Test public void testReadOutOfBounds() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); byte[] buf = new byte[1024]; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base32InputStrea...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testKnownDecodings() { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes(Charsets.UTF_8)))); as...
#fixed code @Test public void testKnownDecodings() { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes(CHARSET_UTF8)))); assertEqua...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReadNull() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base32InputStream in = new Base32InputStream(bin, true...
#fixed code @Test public void testReadNull() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base32InputStream in = new Base32InputStream(bin, true, 4, n...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipNone() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); byte[] actualBytes = new byte[6]; as...
#fixed code @Test public void testSkipNone() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); byte[] actualBytes = new byte[6]; assertEq...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testCodec101() throws Exception { byte[] codec101 = StringUtils.getBytesUtf8(Base64TestData.CODEC_101_MULTIPLE_OF_3); ByteArrayInputStream bais = new ByteArrayInputStream(codec101); Base64InputStream in = new Base64InputStre...
#fixed code @Test public void testCodec101() throws Exception { byte[] codec101 = StringUtils.getBytesUtf8(Base64TestData.CODEC_101_MULTIPLE_OF_3); ByteArrayInputStream bais = new ByteArrayInputStream(codec101); Base64InputStream in = new Base64InputStream(bai...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testDecodePadMarkerIndex2() { assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes()))); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public void testDecodePadMarkerIndex2() throws UnsupportedEncodingException { assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes("UTF-8")))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); // due to CODEC-130, skip now skips correct...
#fixed code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); // due to CODEC-130, skip now skips correctly dec...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEncodeAtzNotEmpty() throws EncoderException { BeiderMorseEncoder bmpm = new BeiderMorseEncoder(); bmpm.setNameType(NameType.GENERIC); bmpm.setRuleType(RuleType.APPROX); String[] names = { "ácz", "átz", "Ignácz", ...
#fixed code @Test public void testEncodeAtzNotEmpty() throws EncoderException { BeiderMorseEncoder bmpm = new BeiderMorseEncoder(); bmpm.setNameType(NameType.GENERIC); bmpm.setRuleType(RuleType.APPROX); String[] names = { "ácz", "átz", "Ignácz", "Ignát...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadMarkerIndex2() throws UnsupportedEncodingException { assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes("UTF-8")))); } #location 3 #vulnerability type ...
#fixed code @Test public void testDecodePadMarkerIndex2() throws UnsupportedEncodingException { assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes(Charsets.UTF_8)))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipNone() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); byte[] actualBytes = new byte[6]; as...
#fixed code @Test public void testSkipNone() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); byte[] actualBytes = new byte[6]; assertEq...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); assertEquals(8, b32stream.skip(10)); ...
#fixed code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); // due to CODEC-130, skip now skips correctly d...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testInputStreamReader() throws Exception { byte[] codec101 = StringUtils.getBytesUtf8(Base64TestData.CODEC_101_MULTIPLE_OF_3); ByteArrayInputStream bais = new ByteArrayInputStream(codec101); Base64InputStream in = new Base64...
#fixed code @Test public void testInputStreamReader() throws Exception { byte[] codec101 = StringUtils.getBytesUtf8(Base64TestData.CODEC_101_MULTIPLE_OF_3); ByteArrayInputStream bais = new ByteArrayInputStream(codec101); Base64InputStream in = new Base64InputS...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testObjectEncode() throws Exception { Base64 b64 = new Base64(); assertEquals("SGVsbG8gV29ybGQ=", new String(b64.encode("Hello World".getBytes("UTF-8")))); } #location 4 ...
#fixed code @Test public void testObjectEncode() throws Exception { Base64 b64 = new Base64(); assertEquals("SGVsbG8gV29ybGQ=", new String(b64.encode("Hello World".getBytes(Charsets.UTF_8)))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testKnownDecodings() throws UnsupportedEncodingException { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".get...
#fixed code @Test public void testKnownDecodings() throws UnsupportedEncodingException { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testObjectEncode() throws Exception { final Base64 b64 = new Base64(); assertEquals("SGVsbG8gV29ybGQ=", new String(b64.encode("Hello World".getBytes(Charsets.UTF_8)))); } #location 4 ...
#fixed code @Test public void testObjectEncode() throws Exception { final Base64 b64 = new Base64(); assertEquals("SGVsbG8gV29ybGQ=", new String(b64.encode("Hello World".getBytes(CHARSET_UTF8)))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadMarkerIndex2() { assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes(Charsets.UTF_8)))); } #location 3 #vulnerability type NULL_DEREFERENCE
#fixed code @Test public void testDecodePadMarkerIndex2() { assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes(CHARSET_UTF8)))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); assertEquals(8, b64stream.skip(8)); ...
#fixed code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); // due to CODEC-130, skip now skips correctly dec...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testDecodePadOnlyChunked() { assertTrue(Base64.decodeBase64("====\n".getBytes()).length == 0); assertEquals("", new String(Base64.decodeBase64("====\n".getBytes()))); // Test truncated padding assertTrue(Base64.decodeBase64("=...
#fixed code public void testDecodePadOnlyChunked() throws UnsupportedEncodingException { assertTrue(Base64.decodeBase64("====\n".getBytes("UTF-8")).length == 0); assertEquals("", new String(Base64.decodeBase64("====\n".getBytes("UTF-8")))); // Test truncated paddi...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testWriteToNullCoverage() throws Exception { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Base64OutputStream out = new Base64OutputStream(bout); try { out.write(null, 0, 0); fail("Expcted...
#fixed code @Test public void testWriteToNullCoverage() throws Exception { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Base64OutputStream out = new Base64OutputStream(bout); try { out.write(null, 0, 0); fail("Expcted Base6...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testRead0() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); byte[] buf = new byte[1024]; int bytesRead = 0; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64In...
#fixed code @Test public void testRead0() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); byte[] buf = new byte[1024]; int bytesRead = 0; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64InputStr...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadOnlyChunked() throws UnsupportedEncodingException { assertEquals(0, Base64.decodeBase64("====\n".getBytes("UTF-8")).length); assertEquals("", new String(Base64.decodeBase64("====\n".getBytes("UTF-8")))); // Test...
#fixed code @Test public void testDecodePadOnlyChunked() throws UnsupportedEncodingException { assertEquals(0, Base64.decodeBase64("====\n".getBytes(Charsets.UTF_8)).length); assertEquals("", new String(Base64.decodeBase64("====\n".getBytes(Charsets.UTF_8)))); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadOnly() { assertEquals(0, Base64.decodeBase64("====".getBytes(Charsets.UTF_8)).length); assertEquals("", new String(Base64.decodeBase64("====".getBytes(Charsets.UTF_8)))); // Test truncated padding assert...
#fixed code @Test public void testDecodePadOnly() { assertEquals(0, Base64.decodeBase64("====".getBytes(CHARSET_UTF8)).length); assertEquals("", new String(Base64.decodeBase64("====".getBytes(CHARSET_UTF8)))); // Test truncated padding assertEquals(0, ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); assertEquals(8, b32stream.skip(8)); ...
#fixed code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); // due to CODEC-130, skip now skips correctly dec...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testMarkSupported() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base32InputStream in = new Base32InputStream(bin,...
#fixed code @Test public void testMarkSupported() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base32InputStream in = new Base32InputStream(bin, true,...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAvailable() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); assertEquals(1, b64stream.available()); ...
#fixed code @Test public void testAvailable() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); assertEquals(1, b64stream.available()); a...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadOnlyChunked() { assertEquals(0, Base64.decodeBase64("====\n".getBytes(Charsets.UTF_8)).length); assertEquals("", new String(Base64.decodeBase64("====\n".getBytes(Charsets.UTF_8)))); // Test truncated padding ...
#fixed code @Test public void testDecodePadOnlyChunked() { assertEquals(0, Base64.decodeBase64("====\n".getBytes(CHARSET_UTF8)).length); assertEquals("", new String(Base64.decodeBase64("====\n".getBytes(CHARSET_UTF8)))); // Test truncated padding asser...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBase64() { String content = "Hello World"; String encodedContent; byte[] encodedBytes = Base64.encodeBase64(StringUtils.getBytesUtf8(content)); encodedContent = StringUtils.newStringUtf8(encodedBytes); as...
#fixed code @Test public void testBase64() { String content = "Hello World"; String encodedContent; byte[] encodedBytes = Base64.encodeBase64(StringUtils.getBytesUtf8(content)); encodedContent = StringUtils.newStringUtf8(encodedBytes); assertEq...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testKnownDecodings() { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes()))); assertEquals("It was the b...
#fixed code public void testKnownDecodings() throws UnsupportedEncodingException { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes("UTF-8")))...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testRead0() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); byte[] buf = new byte[1024]; int bytesRead = 0; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); ...
#fixed code @Test public void testRead0() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE); byte[] buf = new byte[1024]; int bytesRead = 0; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadMarkerIndex3() { assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes(Charsets.UTF_8)))); assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes(Charsets.UTF_8)))); } ...
#fixed code @Test public void testDecodePadMarkerIndex3() { assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes(CHARSET_UTF8)))); assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes(CHARSET_UTF8)))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testWriteToNullCoverage() throws Exception { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Base32OutputStream out = new Base32OutputStream(bout); try { out.write(null, 0, 0); fail("Expcted...
#fixed code @Test public void testWriteToNullCoverage() throws Exception { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Base32OutputStream out = new Base32OutputStream(bout); try { out.write(null, 0, 0); fail("Expcted Base3...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); // due to CODEC-130, skip now skips correct...
#fixed code @Test public void testSkipToEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); // due to CODEC-130, skip now skips correctly dec...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testDecodePadOnly() { assertTrue(Base64.decodeBase64("====".getBytes()).length == 0); assertEquals("", new String(Base64.decodeBase64("====".getBytes()))); // Test truncated padding assertTrue(Base64.decodeBase64("===".getByte...
#fixed code public void testDecodePadOnly() throws UnsupportedEncodingException { assertTrue(Base64.decodeBase64("====".getBytes("UTF-8")).length == 0); assertEquals("", new String(Base64.decodeBase64("====".getBytes("UTF-8")))); // Test truncated padding ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadOnly() throws UnsupportedEncodingException { assertEquals(0, Base64.decodeBase64("====".getBytes("UTF-8")).length); assertEquals("", new String(Base64.decodeBase64("====".getBytes("UTF-8")))); // Test truncated ...
#fixed code @Test public void testDecodePadOnly() throws UnsupportedEncodingException { assertEquals(0, Base64.decodeBase64("====".getBytes(Charsets.UTF_8)).length); assertEquals("", new String(Base64.decodeBase64("====".getBytes(Charsets.UTF_8)))); // Test tr...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); assertEquals(8, b64stream.skip(10)); ...
#fixed code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); // due to CODEC-130, skip now skips correctly d...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testIgnoringNonBase64InDecode() throws Exception { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6eSBkb...
#fixed code public void testIgnoringNonBase64InDecode() throws Exception { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg=...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReadNull() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64InputStream in = new Base64InputStream(bin, true, 4, new byte[]...
#fixed code @Test public void testReadNull() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64InputStream in = new Base64InputStream(bin, true, 4, new byte[] { 0, ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testKnownEncodings() { assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", new String(Base64 .encodeBase64("The quick brown fox jumped over the lazy dogs.".getBytes(Charsets.UTF_8)))); as...
#fixed code @Test public void testKnownEncodings() { assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", new String(Base64 .encodeBase64("The quick brown fox jumped over the lazy dogs.".getBytes(CHARSET_UTF8)))); assertEqua...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReadOutOfBounds() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); byte[] buf = new byte[1024]; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64InputStream in = ne...
#fixed code @Test public void testReadOutOfBounds() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); byte[] buf = new byte[1024]; ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64InputStream in = new Base...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testIgnoringNonBase64InDecode() throws Exception { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGU...
#fixed code @Test public void testIgnoringNonBase64InDecode() throws Exception { assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64 .decodeBase64("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6e...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipBig() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); assertEquals(6, b64stream.skip(Integer.MAX_VA...
#fixed code @Test public void testSkipBig() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B64)); Base64InputStream b64stream = new Base64InputStream(ins); assertEquals(6, b64stream.skip(Integer.MAX_VALUE));...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipBig() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); assertEquals(3, b32stream.skip(1024)); ...
#fixed code @Test public void testSkipBig() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); assertEquals(3, b32stream.skip(1024)); // E...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testMarkSupported() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64InputStream in = new Base64InputStream(bin, true, 4, new b...
#fixed code @Test public void testMarkSupported() throws Exception { byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE); ByteArrayInputStream bin = new ByteArrayInputStream(decoded); Base64InputStream in = new Base64InputStream(bin, true, 4, new byte[] ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testDecodePadMarkerIndex3() throws UnsupportedEncodingException { assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes("UTF-8")))); assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes("UTF-8")))); } ...
#fixed code @Test public void testDecodePadMarkerIndex3() throws UnsupportedEncodingException { assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes(Charsets.UTF_8)))); assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes(Charsets.UTF_8))));...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testKnownEncodings() throws UnsupportedEncodingException { assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", new String(Base64 .encodeBase64("The quick brown fox jumped over the lazy dogs.".get...
#fixed code @Test public void testKnownEncodings() throws UnsupportedEncodingException { assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", new String(Base64 .encodeBase64("The quick brown fox jumped over the lazy dogs.".getBytes(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testBase64() { String content = "Hello World"; String encodedContent; encodedContent = new String(Base64.encodeBase64(content.getBytes())); assertTrue("encoding hello world", encodedContent.equals("SGVsbG8gV29ybGQ=")); } ...
#fixed code public void testBase64() { String content = "Hello World"; String encodedContent; byte[] encodedBytes = Base64.encodeBase64(StringUtils.getBytesUtf8(content)); encodedContent = StringUtils.newStringUtf8(encodedBytes); assertTrue("encodi...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAvailable() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); assertEquals(1, b32stream.available()); ...
#fixed code @Test public void testAvailable() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); assertEquals(1, b32stream.available()); a...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); // due to CODEC-130, skip now skips corre...
#fixed code @Test public void testSkipPastEnd() throws Throwable { InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_FOO)); Base32InputStream b32stream = new Base32InputStream(ins); // due to CODEC-130, skip now skips correctly d...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void bind() { if (bound) throw new IllegalStateException("Already bound to " + assignedThread); bound = true; assignedThread = Thread.currentThread(); AffinitySupport.setAffinity(1L << id); if (LOGGER.isLoggable(Level.INFO)...
#fixed code public void bind() { bind(false); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static VanillaCpuLayout fromProperties(String fileName) throws IOException { return fromProperties(new FileInputStream(fileName)); } #location 2 #vulnerability type RESOURCE_LEAK
#fixed code public static VanillaCpuLayout fromProperties(String fileName) throws IOException { return fromProperties(openFile(fileName)); }
Below is the vulnerable code, please generate the patch based on the following information.