[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r106656: Don't crash on bad user inpu
From: |
Jan D. |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r106656: Don't crash on bad user input. |
Date: |
Sat, 10 Dec 2011 15:01:08 +0100 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 106656
fixes bug(s): http://debbugs.gnu.org/10103
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sat 2011-12-10 15:01:08 +0100
message:
Don't crash on bad user input.
* nsfns.m (ns_get_defaults_value): New function.
(Fns_get_resource, x_get_string_resource): Call ns_get_defaults_value.
* nsterm.h (ns_get_defaults_value): Declare.
* nsterm.m (ns_default): Call ns_get_defaults_value.
modified:
src/ChangeLog
src/nsfns.m
src/nsterm.h
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-12-09 18:40:42 +0000
+++ b/src/ChangeLog 2011-12-10 14:01:08 +0000
@@ -1,3 +1,12 @@
+2011-12-10 Jan Djärv <address@hidden>
+
+ * nsfns.m (ns_get_defaults_value): New function (Bug#10103).
+ (Fns_get_resource, x_get_string_resource): Call ns_get_defaults_value.
+
+ * nsterm.h (ns_get_defaults_value): Declare.
+
+ * nsterm.m (ns_default): Call ns_get_defaults_value.
+
2011-12-09 Eli Zaretskii <address@hidden>
* xdisp.c (try_scrolling): Don't set scroll_down_p if dy is zero.
=== modified file 'src/nsfns.m'
--- a/src/nsfns.m 2011-12-04 13:25:16 +0000
+++ b/src/nsfns.m 2011-12-10 14:01:08 +0000
@@ -1546,6 +1546,17 @@
return ret ? fname : Qnil;
}
+const char *
+ns_get_defaults_value (const char *key)
+{
+ NSObject *obj = [[NSUserDefaults standardUserDefaults]
+ objectForKey: [NSString stringWithUTF8String: key]];
+
+ if (!obj) return NULL;
+
+ return [[NSString stringWithFormat: @"%@", obj] UTF8String];
+}
+
DEFUN ("ns-get-resource", Fns_get_resource, Sns_get_resource, 2, 2, 0,
doc: /* Return the value of the property NAME of OWNER from the
defaults database.
@@ -1560,9 +1571,7 @@
CHECK_STRING (name);
/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name));
*/
- value =[[[NSUserDefaults standardUserDefaults]
- objectForKey: [NSString stringWithUTF8String: SDATA (name)]]
- UTF8String];
+ value = ns_get_defaults_value (SDATA (name));
if (value)
return build_string (value);
@@ -2217,8 +2226,7 @@
/* --quick was passed, so this is a no-op. */
return NULL;
- res = [[[NSUserDefaults standardUserDefaults] objectForKey:
- [NSString stringWithUTF8String: toCheck]] UTF8String];
+ res = ns_get_defaults_value (toCheck);
return !res ? NULL :
(!strncasecmp (res, "YES", 3) ? "true" :
(!strncasecmp (res, "NO", 2) ? "false" : res));
=== modified file 'src/nsterm.h'
--- a/src/nsterm.h 2011-11-20 19:35:27 +0000
+++ b/src/nsterm.h 2011-12-10 14:01:08 +0000
@@ -760,6 +760,7 @@
extern void ns_retain_object (void *obj);
extern void *ns_alloc_autorelease_pool ();
extern void ns_release_autorelease_pool ();
+extern const char *ns_get_defaults_value ();
/* in nsmenu */
extern void update_frame_tool_bar (FRAME_PTR f);
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2011-12-05 08:55:25 +0000
+++ b/src/nsterm.m 2011-12-10 14:01:08 +0000
@@ -3824,11 +3824,9 @@
Check a parameter value in user's preferences
--------------------------------------------------------------------------
*/
{
- const char *value;
+ const char *value = ns_get_defaults_value (parameter);
- if ( (value =[[[NSUserDefaults standardUserDefaults]
- stringForKey: [NSString stringWithUTF8String: parameter]]
- UTF8String]) )
+ if (value)
{
double f;
char *pos;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r106656: Don't crash on bad user input.,
Jan D. <=