unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25364: etags malloc problems
@ 2017-01-05  3:07 5upnzm+87w9w470225qs
  2017-01-05 15:36 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: 5upnzm+87w9w470225qs @ 2017-01-05  3:07 UTC (permalink / raw)
  To: 25364

[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]

clang-3.9  -g -pipe -Wall -O1 -fsanitize=address -fno-omit-frame-pointer   -MD  -MF.depend.etags.o -MTetags.o -std=gnu99 -fstack-protector-strong    -Qunused-arguments  -c etags.c -o etags.o
etags.c:6367:25: warning: assigning to 'unsigned char *' from 'char [256]'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
      patbuf->translate = lc_trans;     /* translation table to fold case  */
                        ^ ~~~~~~~~
1 warning generated.
clang-3.9 -g -pipe -Wall -O1 -fsanitize=address -fno-omit-frame-pointer -std=gnu99 -fstack-protector-strong -Qunused-arguments  -o etags etags.o  
echo ./etags.c | ./etags -l auto -S -

=================================================================
==5176==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 120 byte(s) in 1 object(s) allocated from:
    #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
    #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
    #2 0x5036c5 in main /tmp/etags/etags.c:1097:15
    #3 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
    #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
    #2 0x5036b8 in main /tmp/etags/etags.c:1091:20
    #3 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
    #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
    #2 0x50447c in concat /tmp/etags/etags.c:6958:18
    #3 0x503706 in main /tmp/etags/etags.c:1109:15
    #4 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

SUMMARY: AddressSanitizer: 184 byte(s) leaked in 3 allocation(s).

the attached patch is what i used to make etags.c compile.





----
Sent using Sharklasers.com
Block or report abuse: https://www.sharklasers.com//abuse/?a=Q1RzSAoOVvkQhQ%2B3414YfAGJQtiX

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: etagswithoutemacs.diff --]
[-- Type: text/x-patch; name="etagswithoutemacs.diff", Size: 1316 bytes --]

--- etags.c	2017-01-04 18:32:12.110527356 -0800
+++ etags.c2	2017-01-04 18:53:39.689974623 -0800
@@ -80,2 +80,18 @@ University of California, as described a
 
+#define ATTRIBUTE_CONST	__attribute__((const))
+#define ATTRIBUTE_FORMAT_PRINTF(x,y)	__attribute__((format(printf,x,y)))
+#define COPYRIGHT	"I PREFER VIM"
+#define FOPEN_BINARY	"b"
+#define SET_BINARY(fd)
+#define c_isalnum	isalnum
+#define c_isalpha	isalpha
+#define c_isdigit	isdigit
+#define c_islower	islower
+#define c_isspace	isspace
+#define c_isupper	isupper
+#define c_strcasecmp	strcasecmp
+#define c_strncasecmp	strncasecmp
+#define c_tolower	tolower
+#define ptrdiff_t	__PTRDIFF_TYPE__
+
 char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
@@ -90,3 +106,5 @@ char pot_etags_version[] = "@(#) pot rev
 
-#include <config.h>
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1		/* enables some compiler checks on GNU */
+#endif
 
@@ -116,2 +134,3 @@ char pot_etags_version[] = "@(#) pot rev
 
+#include <ctype.h>
 #include <limits.h>
@@ -119,10 +138,8 @@ char pot_etags_version[] = "@(#) pot rev
 #include <stdarg.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sysstdio.h>
+#include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <binary-io.h>
-#include <c-ctype.h>
-#include <c-strcase.h>
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#25364: etags malloc problems
  2017-01-05  3:07 bug#25364: etags malloc problems 5upnzm+87w9w470225qs
@ 2017-01-05 15:36 ` Eli Zaretskii
  2017-01-05 15:52 ` Andreas Schwab
  2017-01-05 16:54 ` Richard Stallman
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2017-01-05 15:36 UTC (permalink / raw)
  To: 5upnzm+87w9w470225qs; +Cc: 25364

> Date: Thu, 05 Jan 2017 03:07:13 +0000
> From: <5upnzm+87w9w470225qs@sharklasers.com>
> 
> clang-3.9  -g -pipe -Wall -O1 -fsanitize=address -fno-omit-frame-pointer   -MD  -MF.depend.etags.o -MTetags.o -std=gnu99 -fstack-protector-strong    -Qunused-arguments  -c etags.c -o etags.o
> etags.c:6367:25: warning: assigning to 'unsigned char *' from 'char [256]'
>       converts between pointers to integer types with different sign
>       [-Wpointer-sign]
>       patbuf->translate = lc_trans;     /* translation table to fold case  */
>                         ^ ~~~~~~~~
> 1 warning generated.

This warning is a harmless nuisance, AFAIU.

> ==5176==ERROR: LeakSanitizer: detected memory leaks
> 
> Direct leak of 120 byte(s) in 1 object(s) allocated from:
>     #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
>     #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
>     #2 0x5036c5 in main /tmp/etags/etags.c:1097:15
>     #3 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
> 
> Direct leak of 40 byte(s) in 1 object(s) allocated from:
>     #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
>     #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
>     #2 0x5036b8 in main /tmp/etags/etags.c:1091:20
>     #3 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
> 
> Direct leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
>     #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
>     #2 0x50447c in concat /tmp/etags/etags.c:6958:18
>     #3 0x503706 in main /tmp/etags/etags.c:1109:15
>     #4 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
> 
> SUMMARY: AddressSanitizer: 184 byte(s) leaked in 3 allocation(s).
> 
> the attached patch is what i used to make etags.c compile.

I'm not sure I understand why all those patches are needed.  Is that
just to shut up the above warning?  If there were other problems
during compilation, please show the warning/error messages.

Also, it looks like you are using some old version of the Emacs
sources, because neither Emacs 25.1, the latest released version, nor
the current master branch match the line numbers reported by the
compiler.  Could you try the latest version of the sources, and see if
the problems you found are still there?

Thanks.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#25364: etags malloc problems
  2017-01-05  3:07 bug#25364: etags malloc problems 5upnzm+87w9w470225qs
  2017-01-05 15:36 ` Eli Zaretskii
@ 2017-01-05 15:52 ` Andreas Schwab
  2017-01-05 16:54 ` Richard Stallman
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2017-01-05 15:52 UTC (permalink / raw)
  To: 5upnzm+87w9w470225qs; +Cc: 25364

On Jan 05 2017, <5upnzm+87w9w470225qs@sharklasers.com> wrote:

> ==5176==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 120 byte(s) in 1 object(s) allocated from:
>     #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
>     #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
>     #2 0x5036c5 in main /tmp/etags/etags.c:1097:15
>     #3 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
>
> Direct leak of 40 byte(s) in 1 object(s) allocated from:
>     #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
>     #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
>     #2 0x5036b8 in main /tmp/etags/etags.c:1091:20
>     #3 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
>
> Direct leak of 24 byte(s) in 1 object(s) allocated from:
>     #0 0x4cba68 in __interceptor_malloc (/tmp/etags/etags+0x4cba68)
>     #1 0x5043f8 in xmalloc /tmp/etags/etags.c:7238:18
>     #2 0x50447c in concat /tmp/etags/etags.c:6958:18
>     #3 0x503706 in main /tmp/etags/etags.c:1109:15
>     #4 0x7fb31bc332b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

These are all allocations in main, no point in freeing them if the
process is exiting anyway.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#25364: etags malloc problems
  2017-01-05  3:07 bug#25364: etags malloc problems 5upnzm+87w9w470225qs
  2017-01-05 15:36 ` Eli Zaretskii
  2017-01-05 15:52 ` Andreas Schwab
@ 2017-01-05 16:54 ` Richard Stallman
  2019-09-29 15:17   ` Lars Ingebrigtsen
  2 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2017-01-05 16:54 UTC (permalink / raw)
  To: 5upnzm+87w9w470225qs; +Cc: 25364

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Placating clang is not a design goal of Emacs.  If this is an actual
bug, then we should fix it.  Otherwhse we should ignore it.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#25364: etags malloc problems
  2017-01-05 16:54 ` Richard Stallman
@ 2019-09-29 15:17   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-29 15:17 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 5upnzm+87w9w470225qs, 25364

Richard Stallman <rms@gnu.org> writes:

> Placating clang is not a design goal of Emacs.  If this is an actual
> bug, then we should fix it.  Otherwhse we should ignore it.

I don't think there were any actual bugs in this report, so I'm closing
it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-29 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-05  3:07 bug#25364: etags malloc problems 5upnzm+87w9w470225qs
2017-01-05 15:36 ` Eli Zaretskii
2017-01-05 15:52 ` Andreas Schwab
2017-01-05 16:54 ` Richard Stallman
2019-09-29 15:17   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).