8170525: Fix minor issues in AWT/ECC/PKCS11 coding
Reviewed-by: vinnie, clanger, prr, ssadetsky
This commit is contained in:
parent
c969db1c89
commit
62486246c7
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,6 +72,7 @@ Java_sun_awt_image_DataBufferNative_getElem(JNIEnv *env, jobject dbn,
|
||||
unsigned char *pixelPtr;
|
||||
SurfaceDataRasInfo lockInfo;
|
||||
SurfaceDataOps *ops;
|
||||
lockInfo.rasBase = NULL;
|
||||
|
||||
ops = SurfaceData_GetOps(env, sd);
|
||||
JNU_CHECK_EXCEPTION_RETURN(env, -1);
|
||||
@ -113,7 +114,7 @@ Java_sun_awt_image_DataBufferNative_setElem(JNIEnv *env, jobject dbn,
|
||||
SurfaceDataRasInfo lockInfo;
|
||||
SurfaceDataOps *ops;
|
||||
unsigned char *pixelPtr;
|
||||
|
||||
lockInfo.rasBase = NULL;
|
||||
|
||||
ops = SurfaceData_GetOps(env, sd);
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
|
@ -243,8 +243,8 @@ static void AddFontsToX11FontPath ( fDirRecord *fDirP )
|
||||
|
||||
appendDirList[index] = 0;
|
||||
if ( doNotAppend == 0 ) {
|
||||
strcpy ( fontDirPath, fDirP->name[index] );
|
||||
strcat ( fontDirPath, "/fonts.dir" );
|
||||
snprintf(fontDirPath, sizeof(fontDirPath), "%s/fonts.dir", fDirP->name[index]);
|
||||
fontDirPath[sizeof(fontDirPath) - 1] = '\0';
|
||||
dirFile = open ( fontDirPath, O_RDONLY, 0 );
|
||||
if ( dirFile == -1 ) {
|
||||
doNotAppend = 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1235,12 +1235,14 @@ StatusDrawCallback(XIC ic, XPointer client_data,
|
||||
if (status_draw->type == XIMTextType){
|
||||
XIMText *text = (status_draw->data).text;
|
||||
if (text != NULL){
|
||||
if (text->string.multi_byte != NULL){
|
||||
strcpy(statusWindow->status, text->string.multi_byte);
|
||||
if (text->string.multi_byte != NULL) {
|
||||
strncpy(statusWindow->status, text->string.multi_byte, MAX_STATUS_LEN);
|
||||
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
|
||||
}
|
||||
else{
|
||||
else {
|
||||
char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
|
||||
strcpy(statusWindow->status, mbstr);
|
||||
strncpy(statusWindow->status, mbstr, MAX_STATUS_LEN);
|
||||
statusWindow->status[MAX_STATUS_LEN - 1] = '\0';
|
||||
}
|
||||
statusWindow->on = True;
|
||||
onoffStatusWindow(pX11IMData, statusWindow->parent, True);
|
||||
|
@ -2014,9 +2014,7 @@ static gint gtk3_get_ythickness(JNIEnv *env, WidgetType widget_type)
|
||||
static guint8 recode_color(gdouble channel)
|
||||
{
|
||||
guint16 result = (guint16)(channel * 65535);
|
||||
if (result < 0) {
|
||||
result = 0;
|
||||
} else if (result > 65535) {
|
||||
if (result > 65535) {
|
||||
result = 65535;
|
||||
}
|
||||
return (guint8)( result >> 8);
|
||||
@ -2218,6 +2216,7 @@ static void gtk3_style_shade (const GdkRGBA *a, GdkRGBA *b, gdouble k) {
|
||||
static GdkRGBA gtk3_get_color_for_flags(GtkStyleContext* context,
|
||||
GtkStateFlags flags, ColorType color_type) {
|
||||
GdkRGBA c, color;
|
||||
color.alpha = 1;
|
||||
|
||||
switch (color_type)
|
||||
{
|
||||
@ -2266,7 +2265,6 @@ static gint gtk3_get_color_for_state(JNIEnv *env, WidgetType widget_type,
|
||||
{
|
||||
|
||||
gint result = 0;
|
||||
GdkRGBA color;
|
||||
|
||||
GtkStateFlags flags = gtk3_get_state_flags(state_type);
|
||||
|
||||
@ -2285,7 +2283,7 @@ static gint gtk3_get_color_for_state(JNIEnv *env, WidgetType widget_type,
|
||||
| GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_FOCUSED;
|
||||
}
|
||||
|
||||
color = gtk3_get_color_for_flags(context, flags, color_type);
|
||||
GdkRGBA color = gtk3_get_color_for_flags(context, flags, color_type);
|
||||
|
||||
if (recode_color(color.alpha) == 0) {
|
||||
color = gtk3_get_color_for_flags(
|
||||
|
@ -567,7 +567,7 @@ static void update_poll_timeout(int timeout_control) {
|
||||
*/
|
||||
static uint32_t get_poll_timeout(jlong nextTaskTime)
|
||||
{
|
||||
uint32_t ret_timeout;
|
||||
uint32_t ret_timeout = 0;
|
||||
uint32_t timeout;
|
||||
uint32_t taskTimeout;
|
||||
uint32_t flushTimeout;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -863,10 +863,10 @@ isKPevent(XEvent *event)
|
||||
}
|
||||
static void
|
||||
dumpKeysymArray(XEvent *event) {
|
||||
printf(" 0x%X\n",keycodeToKeysym(event->xkey.display, event->xkey.keycode, 0));
|
||||
printf(" 0x%X\n",keycodeToKeysym(event->xkey.display, event->xkey.keycode, 1));
|
||||
printf(" 0x%X\n",keycodeToKeysym(event->xkey.display, event->xkey.keycode, 2));
|
||||
printf(" 0x%X\n",keycodeToKeysym(event->xkey.display, event->xkey.keycode, 3));
|
||||
printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 0));
|
||||
printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 1));
|
||||
printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 2));
|
||||
printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 3));
|
||||
}
|
||||
/*
|
||||
* In a next redesign, get rid of this code altogether.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -809,7 +809,7 @@ SplashGetScaledImageName(const char* jarName, const char* fileName,
|
||||
#ifndef __linux__
|
||||
return JNI_FALSE;
|
||||
#endif
|
||||
*scaleFactor = getNativeScaleFactor(NULL);
|
||||
*scaleFactor = (float)getNativeScaleFactor(NULL);
|
||||
return GetScaledImageName(fileName, scaledImgName, scaleFactor, scaledImageNameLength);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -34,7 +34,7 @@
|
||||
* Dr Vipul Gupta <vipul.gupta@sun.com> and
|
||||
* Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
|
||||
*
|
||||
* Last Modified Date from the Original Code: April 2015
|
||||
* Last Modified Date from the Original Code: Nov 2016
|
||||
*********************************************************************** */
|
||||
|
||||
#include "mplogic.h"
|
||||
@ -258,6 +258,7 @@ ec_NewKey(ECParams *ecParams, ECPrivateKey **privKey,
|
||||
#if EC_DEBUG
|
||||
printf("ec_NewKey called\n");
|
||||
#endif
|
||||
k.dp = (mp_digit*)NULL;
|
||||
|
||||
if (!ecParams || !privKey || !privKeyBytes || (privKeyLen < 0)) {
|
||||
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -34,7 +34,7 @@
|
||||
* Dr Vipul Gupta <vipul.gupta@sun.com> and
|
||||
* Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
|
||||
*
|
||||
* Last Modified Date from the Original Code: March 2012
|
||||
* Last Modified Date from the Original Code: Nov 2016
|
||||
*********************************************************************** */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -119,6 +119,9 @@ gf_populate_params(ECCurveName name, ECFieldType field_type, ECParams *params,
|
||||
params->name = name;
|
||||
curveParams = ecCurve_map[params->name];
|
||||
CHECK_OK(curveParams);
|
||||
if ((strlen(curveParams->genx) + strlen(curveParams->geny)) > 2 * 2 * MAX_ECKEY_LEN) {
|
||||
goto cleanup;
|
||||
}
|
||||
params->fieldID.size = curveParams->size;
|
||||
params->fieldID.type = field_type;
|
||||
if (field_type == ec_field_GFp) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -33,6 +33,7 @@
|
||||
* Contributor(s):
|
||||
* Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
|
||||
*
|
||||
* Last Modified Date from the Original Code: Nov 2016
|
||||
*********************************************************************** */
|
||||
|
||||
#include "mpi.h"
|
||||
@ -72,6 +73,7 @@ ECPoint_mul(const ECGroup *group, const mp_int *k, const mp_int *px,
|
||||
if (group->base_point_mul) {
|
||||
MP_CHECKOK(group->base_point_mul(&kt, rx, ry, group));
|
||||
} else {
|
||||
kt.flag = (mp_sign)0;
|
||||
MP_CHECKOK(group->
|
||||
point_mul(&kt, &group->genx, &group->geny, rx, ry,
|
||||
group));
|
||||
@ -82,6 +84,7 @@ ECPoint_mul(const ECGroup *group, const mp_int *k, const mp_int *px,
|
||||
MP_CHECKOK(group->meth->field_enc(py, ry, group->meth));
|
||||
MP_CHECKOK(group->point_mul(&kt, rx, ry, rx, ry, group));
|
||||
} else {
|
||||
kt.flag = (mp_sign)0;
|
||||
MP_CHECKOK(group->point_mul(&kt, px, py, rx, ry, group));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -34,7 +34,7 @@
|
||||
* Netscape Communications Corporation
|
||||
* Douglas Stebila <douglas@stebila.ca> of Sun Laboratories.
|
||||
*
|
||||
* Last Modified Date from the Original Code: June 2014
|
||||
* Last Modified Date from the Original Code: Nov 2016
|
||||
*********************************************************************** */
|
||||
|
||||
/* Arbitrary precision integer arithmetic library */
|
||||
@ -659,6 +659,7 @@ mp_err mp_expt_d(const mp_int *a, mp_digit d, mp_int *c)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
s.flag = (mp_sign)0;
|
||||
s_mp_exch(&s, c);
|
||||
|
||||
CLEANUP:
|
||||
@ -1609,6 +1610,7 @@ mp_err mp_exptmod_d(const mp_int *a, mp_digit d, const mp_int *m, mp_int *c)
|
||||
goto CLEANUP;
|
||||
}
|
||||
|
||||
s.flag = (mp_sign)0;
|
||||
s_mp_exch(&s, c);
|
||||
|
||||
CLEANUP:
|
||||
@ -4183,6 +4185,7 @@ mp_err s_mp_sqr(mp_int *a)
|
||||
{
|
||||
mp_err res;
|
||||
mp_int tmp;
|
||||
tmp.flag = (mp_sign)0;
|
||||
|
||||
if((res = mp_init_size(&tmp, 2 * USED(a), FLAG(a))) != MP_OKAY)
|
||||
return res;
|
||||
@ -4220,6 +4223,8 @@ mp_err s_mp_div(mp_int *rem, /* i: dividend, o: remainder */
|
||||
mp_digit div_msd;
|
||||
int ix;
|
||||
|
||||
t.dp = (mp_digit *)NULL;
|
||||
|
||||
if(mp_cmp_z(div) == 0)
|
||||
return MP_RANGE;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
|
||||
@ -95,6 +95,8 @@ CK_C_INITIALIZE_ARGS_PTR makeCKInitArgsAdapter(JNIEnv *env, jobject jInitArgs)
|
||||
throwOutOfMemoryError(env, 0);
|
||||
return NULL_PTR;
|
||||
}
|
||||
ckpInitArgs->flags = (CK_FLAGS)0;
|
||||
ckpInitArgs->pReserved = (CK_VOID_PTR)NULL;
|
||||
|
||||
/* Set the mutex functions that will call the Java mutex functions, but
|
||||
* only set it, if the field is not null.
|
||||
|
Loading…
Reference in New Issue
Block a user