Skip to content

Commit

Permalink
8286705: GCC 12 reports use-after-free potential bugs
Browse files Browse the repository at this point in the history
Reviewed-by: phh
Backport-of: 0e4bece5b5143b8505496ea7430bbfa11e151aff
  • Loading branch information
gnu-andrew committed Mar 29, 2024
1 parent 741b340 commit 5d4de36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/java.base/share/native/libjli/parse_manifest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -288,8 +288,8 @@ find_positions(int fd, Byte *eb, jlong* base_offset, jlong* censtart)
for (cp = &buffer[bytes - ENDHDR]; cp >= &buffer[0]; cp--)
if (ENDSIG_AT(cp) && (cp + ENDHDR + ENDCOM(cp) == endpos)) {
(void) memcpy(eb, cp, ENDHDR);
free(buffer);
pos = flen - (endpos - cp);
free(buffer);
return find_positions64(fd, eb, pos, base_offset, censtart);
}
free(buffer);
Expand Down

0 comments on commit 5d4de36

Please sign in to comment.