ref: 1719ff6c9904838f3c270913c45bbf140b33089c
parent: 382246c710d899190d9c0dbc2f971e4542ece1ff
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Nov 24 15:51:32 EST 2017
[nm] Add explicit check in ftell() Ftell() can return -1 if the current position cannot be represented in a long.
--- a/nm/main.c
+++ b/nm/main.c
@@ -118,7 +118,7 @@
while (rdarhdr(fp, &hdr) != EOF) {
pos = ftell(fp);
- if (pos > LONG_MAX - hdr.size) {
+ if (pos == -1 || pos > LONG_MAX - hdr.size) {
fprintf(stderr,
"nm: %s: overflow in size of archive\n",
fname);