Xcode 9 Log: "Month 13 is out of bounds"

I see this weird log when running my app from Xcode 9. I searched my project for for this text, it is not my log. Anyone know what it means?

Replies

>> Earth to Apple, Earth to Apple, come in Apple.


>this is not the channel to report bugs to Apple, really...


That is true, but there's really no way Apple does not know about this bug at this point.


Guess I was the first to mention this and the critical NSUserDefautls bug, which pretty much makes me the man.

Didn't Apple use to Open Source part of CoreFoundation (CFLite)?


I think they stopped releasing it a few macOS versions ago though.

Tracked it down to a launchd plist for a job that uses the StartCalendarInterval key. Unloaded that scheduled job and the UserEventAgent settled down. Not a long term fix but at least my computer is usable.

For me, I can't seem to get this fixed. I even have apps that fail to launch because of this issue! VmWare being one of them.

I experienced the Month 13 bug for the first time.

OSX 10.13 - XCode 9.2 Beta (9c34b)

No external package.


Did not show with XCode 9.2 beta (9c32c) on 10.12.6 with exact same source code.

Do not restart your computer!


RAM and CPU have potential to spike when UserEventAgent and others load plist files on login. Also, some machines are completely broken becuase of the error.

You may try this for fix the issue temporary,

Just disable ReportCrash process,

When Apple fixed the issue, you can re-enable it or not.

After try those command will still get "Month 13 is out of bounds", But cpu will calm down.


Disable ReportCrash

launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist


Enable ReportCrash

launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist

Seems linked to plists, yes.


I get the same error just from doing writeToFile on a .plist

Up-to-date and far more complete CoreFoundation is now part of the Swift Core Libraries:


https://github.com/apple/swift-corelibs-foundation/tree/master/CoreFoundation

The update to 10.13.2 did not resolve the issue.

Didn't install it yet myself. Just took a look at the Release Note. At least they improved Voiceover navigation in Preview. So it is not a total loss.


Nothing in the release notes about App preferences (NSUserDefaults) being fixed either, though I got my fingers crossed that that fix is included as part of improved "stability, and compatibility" of your Mac. I'm holding my breath. Won't be able to update until later tonight though.


Apparently here is the source:


h t t p s : / / github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/NumberDate.subproj/CFDate.c


#define ASSERT_VALID_MONTH(month) do { if (!((month) >= 1 && (month) <= 12)) { os_log_error(OS_LOG_DEFAULT, "Month %d is out of bounds", (int)month); / HALT */ } } while(0)

Today Apple released the OSX 10.13.2 update. It doesn't fix the Month 13 bug. The "Earth to nn" expression is derived from Flash Gordon movies. It's a sort of (three letter acronym censored by Apple).

indeed 10.3.2 did not fix this. omg, this so poor Apple. now we gotta wait another 6 weeks for the next chance for a fix.


the certainity that this would be fixed in 10.3.2 was the only reason i upgraded. what a disappointment.

I have just looked through assembler code of the questioned function __CFYMDFromAbsolute of MacOS X 10.13 with Xcode.


Macho Man ***** Savage, as you mentioned, it resembles that of open source version found in opensource.apple.com/source/CF/CF-744/CFDate.c.

Differences are that some validation codes confirming the value of month have been added in a three different locations within the function.


static void __CFYMDFromAbsolute(int64_t absolute, int64_t *year, int8_t *month, int8_t *day) {
    ....

    if (month || day) {
        int8_t m = absolute / 33 + 1; / search from the approximation */
        bool leap = isleap(y);
        while (__CFDaysBeforeMonth(m + 1, y, leap) <= absolute) m++;

        // Caution: Inaccurate! i am not a hacker 
        // it seems that one of the validation codes has been incorporated around here, like this:

        int8_t tmp = m + 1;
        if (m < 0 || 13 <= tmp) {
            // /usr/include/os/log.h  /usr/lib/system/libsystem_trace.dylib
            if (os_log_type_enabled(oslog, OS_LOG_TYPE_ERROR)) {
                uint8_t buf[16];
                buf[0] = 0;
                buf[1] = 1;
                buf[2] = 0;
                buf[3] = 4;
                *((int32_t *) &buf[4]) = tmp;
                _os_log_error_impl(dso, oslog, OS_LOG_TYPE_ERROR, "Month %d is out of bounds", buf, 8);
            }
        }

        if (month) *month = m;
        if (day) *day = absolute - __CFDaysBeforeMonth(m, y, leap) + 1;
    }
}


I guess they have already addressed this issue and the fix stands by for the future release.

Same problem. In my case while accesing systemgroup.com.apple.configurationprofiles plist I'm getting Month 13 is out of bounds message.


Day by day Apple is producing more buggy softwares. Even newly released PDFKit Framework for iOS 11 is full of bugs 😠