aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog36
-rw-r--r--src/alloc.c10
-rw-r--r--src/fileio.c35
-rw-r--r--src/gnutls.c12
-rw-r--r--src/lread.c49
-rw-r--r--src/process.h2
-rw-r--r--src/xdisp.c4
7 files changed, 95 insertions, 53 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index cf75596f422..f7f68b41838 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -29,8 +29,6 @@
29 now that we have two such functions. All uses changed. 29 now that we have two such functions. All uses changed.
30 (sanitize_char_width): New inline function. 30 (sanitize_char_width): New inline function.
31 31
322011-07-18 Paul Eggert <eggert@cs.ucla.edu>
33
34 Don't assume that tab-width fits in int. 32 Don't assume that tab-width fits in int.
35 * character.h (sanitize_width): New inline function. 33 * character.h (sanitize_width): New inline function.
36 (SANE_TAB_WIDTH): New macro. 34 (SANE_TAB_WIDTH): New macro.
@@ -46,8 +44,6 @@
46 Remove unreachable code. 44 Remove unreachable code.
47 (read_hex, load_charset_map_from_file): Check for integer overflow. 45 (read_hex, load_charset_map_from_file): Check for integer overflow.
48 46
492011-07-17 Paul Eggert <eggert@cs.ucla.edu>
50
51 * xterm.c: don't go over XClientMessageEvent limit 47 * xterm.c: don't go over XClientMessageEvent limit
52 (scroll_bar_windows_size): Now ptrdiff_t, as we prefer signed. 48 (scroll_bar_windows_size): Now ptrdiff_t, as we prefer signed.
53 (x_send_scroll_bar_event): Likewise. Check that the size does not 49 (x_send_scroll_bar_event): Likewise. Check that the size does not
@@ -110,8 +106,6 @@
110 (gs_load): Use printmax_t to print the widest integers possible. 106 (gs_load): Use printmax_t to print the widest integers possible.
111 Check for integer overflow when computing image height and width. 107 Check for integer overflow when computing image height and width.
112 108
1132011-07-17 Paul Eggert <eggert@cs.ucla.edu>
114
115 Integer signedness and overflow and related fixes. (Bug#9079) 109 Integer signedness and overflow and related fixes. (Bug#9079)
116 110
117 * bidi.c: Integer size and overflow fixes. 111 * bidi.c: Integer size and overflow fixes.
@@ -309,6 +303,36 @@
309 Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally 303 Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally
310 well either way, and we prefer signed to unsigned. 304 well either way, and we prefer signed to unsigned.
311 305
3062011-07-18 Paul Eggert <eggert@cs.ucla.edu>
307
308 * fileio.c (Fcopy_file) [!MSDOS]: Tighten created file's mask.
309 This fixes some race conditions on the permissions of any newly
310 created file.
311
312 * alloc.c (valid_pointer_p): Use pipe, not open.
313 This fixes some permissions issues when debugging.
314
315 * fileio.c (Fcopy_file): Adjust mode if fchown fails. (Bug#9002)
316 If fchown fails to set both uid and gid, try to set just gid,
317 as that is sometimes allowed. Adjust the file's mode to eliminate
318 setuid or setgid bits that are inappropriate if fchown fails.
319
3202011-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
321
322 * xdisp.c (next_element_from_string, next_element_from_buffer): Use EQ
323 to compare Lisp_Objects.
324 * gnutls.c (syms_of_gnutls): Rename Vgnutls_log_level to
325 global_gnutls_log_level, don't mistake it for a Lisp_Object.
326 (init_gnutls_functions, emacs_gnutls_handle_error): Fix up uses.
327
3282011-07-17 Andreas Schwab <schwab@linux-m68k.org>
329
330 * lread.c (read_integer): Unread even EOF character.
331 (read1): Likewise. Properly record start position of symbol.
332
333 * lread.c (read1): Read `#:' as empty uninterned symbol if no
334 symbol character follows.
335
3122011-07-17 Paul Eggert <eggert@cs.ucla.edu> 3362011-07-17 Paul Eggert <eggert@cs.ucla.edu>
313 337
314 * fileio.c (Fcopy_file): Pacify gcc re fchown. (Bug#9002) 338 * fileio.c (Fcopy_file): Pacify gcc re fchown. (Bug#9002)
diff --git a/src/alloc.c b/src/alloc.c
index 5848e797b4b..eb0185a8e35 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4430,18 +4430,18 @@ valid_pointer_p (void *p)
4430#ifdef WINDOWSNT 4430#ifdef WINDOWSNT
4431 return w32_valid_pointer_p (p, 16); 4431 return w32_valid_pointer_p (p, 16);
4432#else 4432#else
4433 int fd; 4433 int fd[2];
4434 4434
4435 /* Obviously, we cannot just access it (we would SEGV trying), so we 4435 /* Obviously, we cannot just access it (we would SEGV trying), so we
4436 trick the o/s to tell us whether p is a valid pointer. 4436 trick the o/s to tell us whether p is a valid pointer.
4437 Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may 4437 Unfortunately, we cannot use NULL_DEVICE here, as emacs_write may
4438 not validate p in that case. */ 4438 not validate p in that case. */
4439 4439
4440 if ((fd = emacs_open ("__Valid__Lisp__Object__", O_CREAT | O_WRONLY | O_TRUNC, 0666)) >= 0) 4440 if (pipe (fd) == 0)
4441 { 4441 {
4442 int valid = (emacs_write (fd, (char *)p, 16) == 16); 4442 int valid = (emacs_write (fd[1], (char *) p, 16) == 16);
4443 emacs_close (fd); 4443 emacs_close (fd[1]);
4444 unlink ("__Valid__Lisp__Object__"); 4444 emacs_close (fd[0]);
4445 return valid; 4445 return valid;
4446 } 4446 }
4447 4447
diff --git a/src/fileio.c b/src/fileio.c
index af11e927059..60ee35bb399 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -38,8 +38,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#include <selinux/context.h> 38#include <selinux/context.h>
39#endif 39#endif
40 40
41#include <ignore-value.h>
42
43#include "lisp.h" 41#include "lisp.h"
44#include "intervals.h" 42#include "intervals.h"
45#include "buffer.h" 43#include "buffer.h"
@@ -1939,10 +1937,19 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
1939 | (NILP (ok_if_already_exists) ? O_EXCL : 0), 1937 | (NILP (ok_if_already_exists) ? O_EXCL : 0),
1940 S_IREAD | S_IWRITE); 1938 S_IREAD | S_IWRITE);
1941#else /* not MSDOS */ 1939#else /* not MSDOS */
1942 ofd = emacs_open (SSDATA (encoded_newname), 1940 {
1943 O_WRONLY | O_TRUNC | O_CREAT 1941 int new_mask = 0666;
1944 | (NILP (ok_if_already_exists) ? O_EXCL : 0), 1942 if (input_file_statable_p)
1945 0666); 1943 {
1944 if (!NILP (preserve_uid_gid))
1945 new_mask = 0600;
1946 new_mask &= st.st_mode;
1947 }
1948 ofd = emacs_open (SSDATA (encoded_newname),
1949 (O_WRONLY | O_TRUNC | O_CREAT
1950 | (NILP (ok_if_already_exists) ? O_EXCL : 0)),
1951 new_mask);
1952 }
1946#endif /* not MSDOS */ 1953#endif /* not MSDOS */
1947 if (ofd < 0) 1954 if (ofd < 0)
1948 report_file_error ("Opening output file", Fcons (newname, Qnil)); 1955 report_file_error ("Opening output file", Fcons (newname, Qnil));
@@ -1961,9 +1968,21 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
1961 owner and group. */ 1968 owner and group. */
1962 if (input_file_statable_p) 1969 if (input_file_statable_p)
1963 { 1970 {
1971 int mode_mask = 07777;
1964 if (!NILP (preserve_uid_gid)) 1972 if (!NILP (preserve_uid_gid))
1965 ignore_value (fchown (ofd, st.st_uid, st.st_gid)); 1973 {
1966 if (fchmod (ofd, st.st_mode & 07777) != 0) 1974 /* Attempt to change owner and group. If that doesn't work
1975 attempt to change just the group, as that is sometimes allowed.
1976 Adjust the mode mask to eliminate setuid or setgid bits
1977 that are inappropriate if the owner and group are wrong. */
1978 if (fchown (ofd, st.st_uid, st.st_gid) != 0)
1979 {
1980 mode_mask &= ~06000;
1981 if (fchown (ofd, -1, st.st_gid) == 0)
1982 mode_mask |= 02000;
1983 }
1984 }
1985 if (fchmod (ofd, st.st_mode & mode_mask) != 0)
1967 report_file_error ("Doing chmod", Fcons (newname, Qnil)); 1986 report_file_error ("Doing chmod", Fcons (newname, Qnil));
1968 } 1987 }
1969#endif /* not MSDOS */ 1988#endif /* not MSDOS */
diff --git a/src/gnutls.c b/src/gnutls.c
index 52e80a69ae5..3175f55041d 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -193,8 +193,7 @@ init_gnutls_functions (Lisp_Object libraries)
193 LOAD_GNUTLS_FN (library, gnutls_x509_crt_import); 193 LOAD_GNUTLS_FN (library, gnutls_x509_crt_import);
194 LOAD_GNUTLS_FN (library, gnutls_x509_crt_init); 194 LOAD_GNUTLS_FN (library, gnutls_x509_crt_init);
195 195
196 if (NUMBERP (Vgnutls_log_level)) 196 max_log_level = global_gnutls_log_level;
197 max_log_level = XINT (Vgnutls_log_level);
198 197
199 GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:", 198 GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:",
200 SDATA (Fget (Qgnutls_dll, QCloaded_from))); 199 SDATA (Fget (Qgnutls_dll, QCloaded_from)));
@@ -406,8 +405,7 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
406 if (err >= 0) 405 if (err >= 0)
407 return 0; 406 return 0;
408 407
409 if (NUMBERP (Vgnutls_log_level)) 408 max_log_level = global_gnutls_log_level;
410 max_log_level = XINT (Vgnutls_log_level);
411 409
412 /* TODO: use gnutls-error-fatalp and gnutls-error-string. */ 410 /* TODO: use gnutls-error-fatalp and gnutls-error-string. */
413 411
@@ -1155,9 +1153,9 @@ syms_of_gnutls (void)
1155 defsubr (&Sgnutls_bye); 1153 defsubr (&Sgnutls_bye);
1156 defsubr (&Sgnutls_available_p); 1154 defsubr (&Sgnutls_available_p);
1157 1155
1158 DEFVAR_INT ("gnutls-log-level", Vgnutls_log_level, 1156 DEFVAR_INT ("gnutls-log-level", global_gnutls_log_level,
1159 doc: /* Logging level used by the GnuTLS functions. */); 1157 doc: /* Logging level used by the GnuTLS functions. */);
1160 Vgnutls_log_level = make_number (0); 1158 global_gnutls_log_level = 0;
1161} 1159}
1162 1160
1163#endif /* HAVE_GNUTLS */ 1161#endif /* HAVE_GNUTLS */
diff --git a/src/lread.c b/src/lread.c
index c80ac430671..c0de95dd121 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2327,8 +2327,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
2327 c = READCHAR; 2327 c = READCHAR;
2328 } 2328 }
2329 2329
2330 if (c >= 0) 2330 UNREAD (c);
2331 UNREAD (c);
2332 *p = '\0'; 2331 *p = '\0';
2333 } 2332 }
2334 2333
@@ -2583,8 +2582,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2583 nskip *= 10; 2582 nskip *= 10;
2584 nskip += c - '0'; 2583 nskip += c - '0';
2585 } 2584 }
2586 if (c >= 0) 2585 UNREAD (c);
2587 UNREAD (c);
2588 2586
2589 if (load_force_doc_strings 2587 if (load_force_doc_strings
2590 && (EQ (readcharfun, Qget_file_char) 2588 && (EQ (readcharfun, Qget_file_char)
@@ -2660,7 +2658,17 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2660 { 2658 {
2661 uninterned_symbol = 1; 2659 uninterned_symbol = 1;
2662 c = READCHAR; 2660 c = READCHAR;
2663 goto default_label; 2661 if (!(c > 040
2662 && c != 0x8a0
2663 && (c >= 0200
2664 || strchr ("\"';()[]#`,", c) == NULL)))
2665 {
2666 /* No symbol character follows, this is the empty
2667 symbol. */
2668 UNREAD (c);
2669 return Fmake_symbol (build_string (""));
2670 }
2671 goto read_symbol;
2664 } 2672 }
2665 /* Reader forms that can reuse previously read objects. */ 2673 /* Reader forms that can reuse previously read objects. */
2666 if (c >= '0' && c <= '9') 2674 if (c >= '0' && c <= '9')
@@ -2841,7 +2849,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2841 next_char = READCHAR; 2849 next_char = READCHAR;
2842 ok = (next_char <= 040 2850 ok = (next_char <= 040
2843 || (next_char < 0200 2851 || (next_char < 0200
2844 && (strchr ("\"';()[]#?`,.", next_char)))); 2852 && strchr ("\"';()[]#?`,.", next_char) != NULL));
2845 UNREAD (next_char); 2853 UNREAD (next_char);
2846 if (ok) 2854 if (ok)
2847 return make_number (c); 2855 return make_number (c);
@@ -2966,11 +2974,6 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2966 /* Otherwise, READ_BUFFER contains only ASCII. */ 2974 /* Otherwise, READ_BUFFER contains only ASCII. */
2967 } 2975 }
2968 2976
2969 /* We want readchar_count to be the number of characters, not
2970 bytes. Hence we adjust for multibyte characters in the
2971 string. ... But it doesn't seem to be necessary, because
2972 READCHAR *does* read multibyte characters from buffers. */
2973 /* readchar_count -= (p - read_buffer) - nchars; */
2974 if (read_pure) 2977 if (read_pure)
2975 return make_pure_string (read_buffer, nchars, p - read_buffer, 2978 return make_pure_string (read_buffer, nchars, p - read_buffer,
2976 (force_multibyte 2979 (force_multibyte
@@ -2987,7 +2990,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2987 2990
2988 if (next_char <= 040 2991 if (next_char <= 040
2989 || (next_char < 0200 2992 || (next_char < 0200
2990 && (strchr ("\"';([#?`,", next_char)))) 2993 && strchr ("\"';([#?`,", next_char) != NULL))
2991 { 2994 {
2992 *pch = c; 2995 *pch = c;
2993 return Qnil; 2996 return Qnil;
@@ -3002,9 +3005,12 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3002 if (c <= 040) goto retry; 3005 if (c <= 040) goto retry;
3003 if (c == 0x8a0) /* NBSP */ 3006 if (c == 0x8a0) /* NBSP */
3004 goto retry; 3007 goto retry;
3008
3009 read_symbol:
3005 { 3010 {
3006 char *p = read_buffer; 3011 char *p = read_buffer;
3007 int quoted = 0; 3012 int quoted = 0;
3013 EMACS_INT start_position = readchar_count - 1;
3008 3014
3009 { 3015 {
3010 char *end = read_buffer + read_buffer_size; 3016 char *end = read_buffer + read_buffer_size;
@@ -3035,10 +3041,11 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3035 else 3041 else
3036 *p++ = c; 3042 *p++ = c;
3037 c = READCHAR; 3043 c = READCHAR;
3038 } while (c > 040 3044 }
3039 && c != 0x8a0 /* NBSP */ 3045 while (c > 040
3040 && (c >= 0200 3046 && c != 0x8a0 /* NBSP */
3041 || !(strchr ("\"';()[]#`,", c)))); 3047 && (c >= 0200
3048 || strchr ("\"';()[]#`,", c) == NULL));
3042 3049
3043 if (p == end) 3050 if (p == end)
3044 { 3051 {
@@ -3051,8 +3058,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3051 end = read_buffer + read_buffer_size; 3058 end = read_buffer + read_buffer_size;
3052 } 3059 }
3053 *p = 0; 3060 *p = 0;
3054 if (c >= 0) 3061 UNREAD (c);
3055 UNREAD (c);
3056 } 3062 }
3057 3063
3058 if (!quoted && !uninterned_symbol) 3064 if (!quoted && !uninterned_symbol)
@@ -3080,12 +3086,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3080 if (EQ (Vread_with_symbol_positions, Qt) 3086 if (EQ (Vread_with_symbol_positions, Qt)
3081 || EQ (Vread_with_symbol_positions, readcharfun)) 3087 || EQ (Vread_with_symbol_positions, readcharfun))
3082 Vread_symbol_positions_list = 3088 Vread_symbol_positions_list =
3083 /* Kind of a hack; this will probably fail if characters 3089 Fcons (Fcons (result, make_number (start_position)),
3084 in the symbol name were escaped. Not really a big
3085 deal, though. */
3086 Fcons (Fcons (result,
3087 make_number (readchar_count
3088 - XFASTINT (Flength (Fsymbol_name (result))))),
3089 Vread_symbol_positions_list); 3090 Vread_symbol_positions_list);
3090 return result; 3091 return result;
3091 } 3092 }
diff --git a/src/process.h b/src/process.h
index 4866a8c1022..aff9e970f63 100644
--- a/src/process.h
+++ b/src/process.h
@@ -141,7 +141,7 @@ struct Lisp_Process
141/* Every field in the preceding structure except for the first two 141/* Every field in the preceding structure except for the first two
142 must be a Lisp_Object, for GC's sake. */ 142 must be a Lisp_Object, for GC's sake. */
143 143
144#define ChannelMask(n) (1<<(n)) 144#define ChannelMask(n) (1 << (n))
145 145
146/* True if we are about to fork off a synchronous process or if we 146/* True if we are about to fork off a synchronous process or if we
147 are waiting for it. */ 147 are waiting for it. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 9d521ea7aaf..43f60abb812 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6942,7 +6942,7 @@ next_element_from_string (struct it *it)
6942 struct text_pos position; 6942 struct text_pos position;
6943 6943
6944 xassert (STRINGP (it->string)); 6944 xassert (STRINGP (it->string));
6945 xassert (!it->bidi_p || it->string == it->bidi_it.string.lstring); 6945 xassert (!it->bidi_p || EQ (it->string, it->bidi_it.string.lstring));
6946 xassert (IT_STRING_CHARPOS (*it) >= 0); 6946 xassert (IT_STRING_CHARPOS (*it) >= 0);
6947 position = it->current.string_pos; 6947 position = it->current.string_pos;
6948 6948
@@ -7256,7 +7256,7 @@ next_element_from_buffer (struct it *it)
7256 xassert (IT_CHARPOS (*it) >= BEGV); 7256 xassert (IT_CHARPOS (*it) >= BEGV);
7257 xassert (NILP (it->string) && !it->s); 7257 xassert (NILP (it->string) && !it->s);
7258 xassert (!it->bidi_p 7258 xassert (!it->bidi_p
7259 || (it->bidi_it.string.lstring == Qnil 7259 || (EQ (it->bidi_it.string.lstring, Qnil)
7260 && it->bidi_it.string.s == NULL)); 7260 && it->bidi_it.string.s == NULL));
7261 7261
7262 /* With bidi reordering, the character to display might not be the 7262 /* With bidi reordering, the character to display might not be the