First Mac “Exploit” from MOAB — Yawn…

Yesterday was the start of the Month of Apple Bugs, and I have to say it was a big snooze. The “exploit” supposedly allows a malicious QuickTime “movie” file to run arbitrary code on your Mac. Sounds scary, doesn’t it? Yep. The only problem is you have to really work at it to get the exploit to actually do anything. Supposedly, following this link will demonstrate the exploit and will speak the oh-so-classy message “Happy new year shit bag” using the Mac’s speech synthesizer. Unfortunately, I couldn’t get the exploit to work.

I tried following the link with Firefox and two versions of Safari. In all three cases I got a page with some garbled text on it, but nothing exciting. It’s always funny when someone reveals a supposed “exploit” and includes instructions for “if it doesn’t work for you, then try this.” And that’s what we have here. They have included a Ruby program to generate a file that is just like what you can download, and after running it, you should then “open pwnage.qtl”. I did this, and while QuickTime did open and crash, I didn’t hear the message. To be fair, and to ensure that I didn’t just miss hearing the message, I changed what the “exploit” should try to do. Instead of speaking the message, I changed it to open a terminal window, using “/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal”. Guess what happened. Nothing.

All of this tells me this “exploit” is nothing more than a Mac-hater trying to make people think that Mac’s are “just as vulnerable” as crappy Windows machines.

Let’s see if the rest of the month is as scary and exploitable as yesterday was…

Pasteboard Op Hosed My Mac

Today, during lunch, I continued to work through Aaron Hillegass‘s book, Cocoa Programming for Mac OS X. I was finishing up the chapter on using the Pasteboard for cut & paste, and my sample app was working as it should. And on my shiny Mac Pro, it ran very fast, indeed.

Then I got to the “Challenge” section… The challenge was to have the app copy its data to the pasteboard in both text and PDF formats. I got this working in about 5 minutes; no sweat.

Then I got creative… In the “For the More Curious: Lazy Copying” section, he explained how to have an application tell the pasteboard that it could provide data in various formats, just like usual, but to only put the data on the pasteboard when specifically asked by another app. I thought to myself, “Self, you should implement that with the text + PDF copying you’ve already got working.” And so I did. I got the code written in just a few minutes, referring to the API docs for various help. I ran my app, and copied the data. So far, so good. Then I went into the Preview app, selected File>New From Clipboard… and that’s when things started going South. I got the spinning beach-ball on Preview, and never a window opening. I toggled back over to my app, and it, too, was spinning. I killed Preview and my app, but trying to restart my app resulted in the window showing up, but the spinning beach-ball, and nothing else.

At this point, I figured I had hosed something, so I killed off Xcode and tried to restart it. Same thing as with the others: menubar + spinning beach-ball. Now, I figured a reboot was going to be required. And so it was, but actually rebooting proved to be a problem. I started killing off all my apps and while some would actually quit, some wouldn’t. I tried killing them from Activity Monitor, which worked on some, but not others. I then went to the Apple menu and selected Restart… which eventually timed out trying to kill the running apps. I tried again, but it still wouldn’t restart. I killed some more apps, and tried restarting again, but no dice. I finally killed the power to the box and turned it back on.

If anyone is interested, here are the relevant pieces of code that were involved in this fiasco.

The class is called BigLetterView, and it’s a subclass of NSView. The first method to see is copy:

 	- (IBAction) copy: (id) sender 
	{
 	    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
 	    [self declarePasteboardTypes: pasteboard];
  	    NSLog(@"Backing up data");
 	    [self backupDataForCopy];
 	    NSLog("@Backed up data");
  	    // [self writeStringToPasteboard: pasteboard];
 	    // [self writePdfToPasteboard: pasteboard];
 	} 	

Next is the method called from copy: that makes a copy of the data so that if the current values changes, a paste from another app will get the data as they were when the copy was invoked.

 	- (void) backupDataForCopy
 	{ 
	    backupString = [string copy];
 	    backupPdf = [self generatePdf];
 	} 	

Moving right along, we come to the method that is invoked when another app tries to paste our data from the pasteboard.

 	- (void) pasteboard: (NSPasteboard *) pasteboard provideDataForType: (NSString *) type 	{
 	    NSLog(@"Pasteboard requesting data of type: %@", type);
  	    if ([type isEqual: NSStringPboardType])
 	    {
 	        [self writeStringToPasteboard: pasteboard];
 	    } else if ([type isEqual: NSPDFPboardType])
 	    {
 	        [self writePdfToPasteboard: pasteboard];
 	    } else
 	    {
 	        NSBeep();
 	    }
 	} 	

And, finally, the two methods that write the data to the pasteboard when asked

 	- (void) writePdfToPasteboard: (NSPasteboard *) pasteboard 
	{
 	    // NSData *data = [self generatePdf];
     	    // [pasteboard setData: data forType: NSPDFPboardType];
 	    [pasteboard setData: backupPdf forType: NSPDFPboardType];
 	}

  	- (void) writeStringToPasteboard: (NSPasteboard *) pasteboard
 	{
 	    // copy data to the pasteboard
 	    [pasteboard setString: backupString forType: NSStringPboardType];
 	    // [pasteboard setString: string forType: NSStringPboardType]; 	} 	

The problem seems to be in pasteboard:provideDataForType:, though I can’t see what it is. When I hit Cmd-C, the copy works OK. When I switch to Preview and select File>New From Pasteboard is when everything locks up. What looks to be happening is that the pasteboard service (pbs) is getting hosed, and it’s considered a “critical service” by the OS (I read that in some OSX docs), so if it’s dead/dying other apps who try to contact it are locking up. Makes sense. I tried restarting pbs, but that didn’t seem to make a difference.

So, has anyone else fought with this situation? If so

  • Do you see a problem with the code snippets above?
  • How can you recover from hosing pbs?
  • Any other suggestions?

Wow, That’s Quite a CPU You Have There…

I noticed that when I moved over to the new, shiny Mac Pro that I hadn’t brought over all my digital photos. I’m glad I realized this before whacking the hard drive in the old Windows machine… Anyway, I brought over 2Gb of photos and started importing them into iPhoto. Shortly after it started, I noticed my iconified activity monitor showing activity on all four cores of the CPUs, so I opened it and saw a very large number for CPU percentage for iPhoto. I assume it’s some sort of sum of cpu utilization across the cores, but it looks pretty funny, however they compute it.

Mac Firmware Upgrade Scare

I just got really scared. I noticed that Apple had release a new firmware update for the Mac Pro that said it fixed a bunch of stuff. I followed the directions to install it and all seemed to be going well. I got the progress meter that I saw the last time I updated the firmware, then it restarted, with the (really loud) system “bong”. It initialized one of my monitors with a gray screen and then… nothing. It didn’t go any further. I let it stay like that for a good 10 minutes, not wanting to interrupt anything in progress, but still nothing. Nervousness set in.

Then I remembered something I saw earlier about a firmware restoration CD from Apple. Fortunately I also have an iBook, because in order to create a CD from the download, you have to have a Mac. I made the CD, then followed the directions to use it. Only problem was that it didn’t work. I turned the box off. Then held down the power button until the light flashed rapidly, but the S.O.S. blinkenlichten that were promised in the directions never blinked. Which meant the CD tray never opened, which meant I couldn’t put the restoration CD in to do anything with it. Panic set in.

Then I happened to notice that when it was trying to boot, it did initialize my iPod. I thought maybe, for some strange reason, it doesn’t like/want the iPod plugged in on the reboot. I unplugged the iPod, shutdown the Pro and powered it up again and this time… it worked. After logging in, the firmware updater let me know that my firmware was now the latest version and that all was well. I don’t know why it balked with the iPod plugged in, but I’ll try to remember that next time.

And just now, as I was writing this, I went back and looked at the directions again. And what did I see?

Some USB and FireWire devices may prevent firmware updates from installing correctly. If you are having trouble installing an update try disconnecting non-essential devices and use only an Apple branded keyboard, mouse and monitor.

I guess it really does pay to read the directions all the way to the end before starting something like this. I could have saved myself some serious worrying…

I’m sure I’ll be able to laugh about this at some point, but not yet. If it hadn’t come back up, I would have had to drive half-way to the other side of Atlanta to the nearest Apple store, which would not have made me happy.

One Week After The New Mac’s Arrival

I’ve had my shiny, new Mac Pro for just over one week now and all I can say is “Whoa,” in a very Joey Lawrence sort of way. This thing is the fastest machine I’ve ever owned, and the closest to top-of-the-line I’ve ever been. Granted, I paid a premium for it, but it sho’ is nice.

Eclipse, which on my 1.4GHz AMD box took 45 to 80 seconds to startup, starts in 10 seconds. Yes, that’s 10 seconds. From clicking on the icon to ready-to-accept-user-input, in 10 seconds. And with 2GB of RAM, I can run iTunes, Eclipse, SQuirrelL SQL, SmartCVS, Adium, NeoOffice, TextMate, iTerm, JBoss, two instances of Firefox and Parallels Desktop (running WindowsXP), all at the same time, all without breaking a sweat. It’s a very sweet machine. Oh yeah, the other day I had Serenity playing on one monitor while I was working on the other.

When I decided to get this computer, there was only one Windows app that I was really going to miss, and that was SQLYog. I do most of my SQL work in SQuirreL, but SQLYog has this neat utility to compare the structure of two databases and generate DDL to alter one to look like the other. It’s very handy, and I was going to miss it. Then I noticed that the CodeWeavers folks have made CrossOver available for the Mac. I tried it, got SQLYog running and went ahead and bought a license. I’ve used CrossOver on Linux, and it’s a nice product. My only complaint is that it wants to open dialogs centered across both my monitors, so they end up being split across both monitors, but that’s a small problem, really. I’m just happy I can still run SQLYog.

Anyway, I’m very happy with my machine. I don’t miss Windows at all.

New Mac. Ordered.

Well, I did it. I finally took the plunge. Last night I ordered a Mac Pro, direct from Apple. It has two dual-core 2.66Ghz processors, 2GB of RAM, 250GB of hard drive, USB ports out the wazoo and an NVIDIA GeForce 7300 GT video card that supports dual monitors out of the box. The only difference between what I ordered and the “recommended” configuration is that I doubled the RAM. Consequently my estimated ship date goes from 24 hours to 2 – 4 days. I did upgrade the shipping, so I should have it by Halloween. But that’s 6 days from now. That’s a very long time to wait, knowing that something so lucious is on its way…

I’ve been using a home-brew 1.4Ghz Athlon PC, that I built 5 years ago, and it’s just been getting more and more problematic lately. Last week I spent a whole day re-installing Windows XP and all my software, because it had just gotten too unstable. After the rebuild, it was only marginally better. So I decided a new machine was in order. But what to buy? I had already decided some time ago that I wanted my next computer to be a Mac, but I could get another PC for far less. But did I want to sink any more money into PC-land, when I really wanted to live in Mac-ville? After considering for quite some time, and consulting with my wife, we decided that it made sense to go ahead and get what I really wanted.

Oh, the next 6 days are going be long…

I Got a Mac!

On Tuesday of this week, I traded my no-longer-used Dell Axim PDA for an iBook G4. I owned a Mac Toaster Model back in 1988, but that was a completely different beast. Even though this new Mac is a few years old, and only 800Mhz, it’s amazingly snappy. I have a desktop machine with an Athlon 1.4Ghz chip running XP, and this little Mac feels faster than that. Maybe it’s just because it’s different, but it really does feel that way. I’m very happy with it so far. I have installed a ton of software and have gotten it configured just so. I have my full Java development environment setup (Eclipse, Ant, SmartCVS and SQuirrelSQL) and I can build my company’s software, which is very cool.

Tonight I had a little spare time and started looking into Cocoa development. I knew that the Mac used Objective-C as it’s main development language, but I had never before had the desire to probe Objective-C. As I started looking into it, what do I find? Smalltalk-style calling semantics. I was shocked. I never knew that Obj-C had essentially grafted Smalltalk-style message passing onto the C language. What a surprise. This may end up being quite a bit of fun!

I’m currently just looking online, but I will very shortly want a dead tree to delve further into Cocoa. Any recommendations?