~ubuntu-branches/ubuntu/maverick/xorg-server/maverick-security

« back to all changes in this revision

Viewing changes to Xext/xf86bigfont.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2010-08-05 11:25:14 UTC
  • mfrom: (1.1.35 upstream) (0.1.14 experimental)
  • Revision ID: james.westby@ubuntu.com-20100805112514-q4efdgj3nblevos2
Tags: 2:1.8.99.905-1ubuntu1
* Merge from (unreleased) Debian experimental.  Remaining Ubuntu changes:
  - rules, control:
    + Disable SELinux, libaudit-dev is not in main yet (LP 406226).
      Drop libaudit-dev from build-deps.
  - rules: Enable xcsecurity (LP 247537).
  - local/xvfb-run*: Add correct docs about error codes (LP 328205)
  - rules: Add --with-extra-module-dir to support GL alternatives.
  - control: Xvfb depends on xauth, x11-xkb-utils. (LP 500102)
  - rules, local/64-xorg-xkb.rules: Don't use keyboard-configuration
    until it's available.
  - control: Update some versioned Breaks for Ubuntu versions.
  - debian/patches:
    + 100_rethrow_signals.patch:
      When aborting, re-raise signals for apport
    + 109_fix-swcursor-crash.patch:
      Avoid dereferencing null pointer while reloading cursors during
      resume. (LP 371405)
    + 111_armel-drv-fallbacks.patch:
      Add support for armel driver fallbacks.
    + 121_only_switch_vt_when_active.diff:
      Add a check to prevent the X server from changing the VT when killing
      GDM from the console.
    + 122_xext_fix_card32_overflow_in_xauth.patch:
      Fix server crash when “xauth generate” is called with large timeout.
    + 157_check_null_modes.patch, 162_null_crtc_in_rotation.patch,
      166_nullptr_xinerama_keyrepeat.patch, 167_nullptr_xisbread.patch
      169_mipointer_nullptr_checks.patch,
      172_cwgetbackingpicture_nullptr_check.patch:
      Fix various segfaults in xserver by checking pointers for NULL
      values before dereferencing them.
    + 165_man_xorg_conf_no_device_ident.patch
      Correct man page
    + 168_glibc_trace_to_stderr.patch:
      Report abort traces to stderr instead of terminal
    + 184_virtual_devices_autodetect.patch:
      Use vesa for qemu device, which is not supported by cirrus
    + 187_edid_quirk_hp_nc8430.patch:
      Quirk for another LPL monitor (LP 380009)
    + 188_default_primary_to_first_busid.patch:
      Pick the first device and carry on (LP 459512)
    + 189_xserver_1.5.0_bg_none_root.patch:
      Create a root window with no background.
    + 190_cache-xkbcomp_output_for_fast_start_up.patch:
      Cache keyboard settings.
    + 191-Xorg-add-an-extra-module-path.patch:
      Add support for the alternatives module path.
    + 197_xvfb-randr.patch:
      Adds xrandr support to xvfb. (LP 516123)
    + 198_nohwaccess.patch:
      Adds a -nohwaccess argument to make X not access the hardware
      ports directly.
    + 200_randr-null.patch:
      Clarify a pointer initialization.
* Update changelog entries for 1.8.1.902-1 which became 1.8.99.904-1
* Drop 196_xvfbscreeninit-handling.patch: it's semantically empty, and now 
  doesn't apply.  Merge remaining #include change into 197_xvfb-randr.patch
* New upstream version will start correctly when no outputs are connected,
  as long as the video driver can dynamically resize the framebuffer
  (true for all KMS drivers) (LP: #337889)
* New upstream version fixes crash on non-admin logout with KDE (LP: #569879)
* Refresh 111_armel-drv-fallbacks.patch to fix the build on armel

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
        badSysCall = TRUE;
135
135
    }
136
136
    signal(SIGSYS, oldHandler);
137
 
    return (!badSysCall);
 
137
    return !badSysCall;
138
138
}
139
139
 
140
140
#define MUST_CHECK_FOR_SHM_SYSCALL
230
230
    if (size < 3500)
231
231
        return (ShmDescPtr) NULL;
232
232
 
233
 
    pDesc = xalloc(sizeof(ShmDescRec));
 
233
    pDesc = malloc(sizeof(ShmDescRec));
234
234
    if (!pDesc)
235
235
        return (ShmDescPtr) NULL;
236
236
 
239
239
    if (shmid == -1) {
240
240
        ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
241
241
               size, strerror(errno));
242
 
        xfree(pDesc);
 
242
        free(pDesc);
243
243
        return (ShmDescPtr) NULL;
244
244
    }
245
245
 
247
247
        ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
248
248
               size, strerror(errno));
249
249
        shmctl(shmid, IPC_RMID, (void *) 0);
250
 
        xfree(pDesc);
 
250
        free(pDesc);
251
251
        return (ShmDescPtr) NULL;
252
252
    }
253
253
 
276
276
 
277
277
    if (pDesc->next) pDesc->next->prev = pDesc->prev;
278
278
    *pDesc->prev = pDesc->next;
279
 
    xfree(pDesc);
 
279
    free(pDesc);
280
280
}
281
281
 
282
282
#endif
368
368
    }
369
369
    WriteToClient(client,
370
370
                  sizeof(xXF86BigfontQueryVersionReply), (char *)&reply);
371
 
    return client->noClientException;
 
371
    return Success;
372
372
}
373
373
 
374
374
static void
404
404
    int nCharInfos;
405
405
    int shmid;
406
406
#ifdef HAS_SHM
407
 
    ShmDescPtr pDesc;
 
407
    ShmDescPtr pDesc = NULL;
408
408
#else
409
409
#define pDesc 0
410
410
#endif
427
427
            return BadLength;
428
428
    }
429
429
#endif
430
 
    client->errorValue = stuff->id;             /* EITHER font or gc */
431
 
    dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT,
432
 
                            client, DixGetAttrAccess);
433
 
    if (!pFont) {
434
 
        GC *pGC;
435
 
        dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC,
436
 
                                client, DixGetAttrAccess);
437
 
        if (!pGC)
438
 
            return BadFont;    /* procotol spec says only error is BadFont */
439
 
 
440
 
        pFont = pGC->font;
441
 
    }
 
430
    if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) != Success)
 
431
        return BadFont;    /* procotol spec says only error is BadFont */
442
432
 
443
433
    pmax = FONTINKMAX(pFont);
444
434
    pmin = FONTINKMIN(pFont);
459
449
#ifdef HAS_SHM
460
450
        if (!badSysCall)
461
451
            pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
462
 
        else
463
 
            pDesc = NULL;
464
452
        if (pDesc) {
465
453
            pCI = (xCharInfo *) pDesc->attach_addr;
466
454
            if (stuff_flags & XF86Bigfont_FLAGS_Shm)
474
462
                shmid = pDesc->shmid;
475
463
            } else {
476
464
#endif
477
 
                pCI = xalloc(nCharInfos * sizeof(xCharInfo));
 
465
                pCI = malloc(nCharInfos * sizeof(xCharInfo));
478
466
                if (!pCI)
479
467
                    return BadAlloc;
480
468
#ifdef HAS_SHM
536
524
            if (hashModulus > nCharInfos+1)
537
525
                hashModulus = nCharInfos+1;
538
526
 
539
 
            tmp = xalloc((4*nCharInfos+1) * sizeof(CARD16));
 
527
            tmp = malloc((4*nCharInfos+1) * sizeof(CARD16));
540
528
            if (!tmp) {
541
 
                if (!pDesc) xfree(pCI);
 
529
                if (!pDesc) free(pCI);
542
530
                return BadAlloc;
543
531
            }
544
532
            pIndex2UniqIndex = tmp;
620
608
              ? nUniqCharInfos * sizeof(xCharInfo)
621
609
                + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
622
610
              : 0);
623
 
        xXF86BigfontQueryFontReply* reply = xalloc(rlength);
 
611
        xXF86BigfontQueryFontReply* reply = malloc(rlength);
624
612
        char* p;
625
613
        if (!reply) {
626
614
            if (nCharInfos > 0) {
627
 
                if (shmid == -1) xfree(pIndex2UniqIndex);
628
 
                if (!pDesc) xfree(pCI);
 
615
                if (shmid == -1) free(pIndex2UniqIndex);
 
616
                if (!pDesc) free(pCI);
629
617
            }
630
618
            return BadAlloc;
631
619
        }
703
691
            }
704
692
        }
705
693
        WriteToClient(client, rlength, (char *)reply);
706
 
        xfree(reply);
 
694
        free(reply);
707
695
        if (nCharInfos > 0) {
708
 
            if (shmid == -1) xfree(pIndex2UniqIndex);
709
 
            if (!pDesc) xfree(pCI);
 
696
            if (shmid == -1) free(pIndex2UniqIndex);
 
697
            if (!pDesc) free(pCI);
710
698
        }
711
 
        return (client->noClientException);
 
699
        return Success;
712
700
    }
713
701
}
714
702