That seems reasonable. The patch seems fine, thanks for working on this. Jim
> On Jul 4, 2014, at 2:26 AM, Jean-Daniel Dupas <[email protected]> wrote: > > > We already have a dependency on Foundation in > "LaunchInNewTerminalWithAppleScript()" which uses NSAppleScript. > > And unless we decide to stuck with a lot of deprecated function, we will have > to use both Foundation and AppKit anyway. > > Most of the LaunchServices framework is deprecated in 10.10 and the > recommended API to replace it is NSWorkSpace which is part of AppKit. > > > Le 4 juil. 2014 à 00:04, [email protected] a écrit : > >> >> We originally decided to avoid Foundation if we could, though I don't >> remember why. If we don't object to using Foundation on the Mac then this >> is fine. >> >> Anybody else have an opinion about that? >> >> Jim >> >>> On Jul 3, 2014, at 1:23 PM, Jean-Daniel Dupas <[email protected]> >>> wrote: >>> >>> Hello, >>> >>> I have a question about that piece of code in Host::GetOSVersion for OS X. >>> >>> >>> CFStringRef product_version_cfstr = (CFStringRef) >>> product_version_value; >>> product_version_str = >>> CFStringGetCStringPtr(product_version_cfstr, kCFStringEncodingUTF8); >>> if (product_version_str != NULL) { >>> if (CFStringGetCString(product_version_cfstr, >>> buffer, 256, kCFStringEncodingUTF8)) >>> product_version_str = buffer; >>> } >>> >>> If CFStringGetCStringPtr() returns NULL, the call to CFStringGetCString() >>> which is perfectly valid will never be executed. >>> If it returns a valid pointer, we discard the result by calling >>> CFStringGetCString(). >>> >>> And if we reverse the check and fallback to CFStringGetCString() only when >>> CFStringGetCStringPtr returns NULL, we will end up with a reference to a >>> freed string at the time we try to parse it (as the owner of the string is >>> property_list) >>> >>> Anyway, here is a patch that replaces that whole function by 4 lines of >>> Obj-C. As a bonus, it removes a call to >>> CFURLCreateDataAndPropertiesFromResource() which is now deprecated. >>> >>> Please review. Thanks >>> -- Jean-Daniel >>> >>> >>> >>> <osvers.patch>_______________________________________________ >>> lldb-commits mailing list >>> [email protected] >>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >> > > -- Jean-Daniel > > > > _______________________________________________ lldb-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
