project
stringclasses 633
values | commit_id
stringlengths 7
81
| target
int64 0
1
| func
stringlengths 5
484k
| cwe
stringclasses 131
values | big_vul_idx
float64 0
189k
⌀ | idx
int64 0
522k
| hash
stringlengths 34
39
| size
float64 1
24k
⌀ | message
stringlengths 0
11.5k
⌀ | dataset
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint pix;
Guchar *destPtr0, *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1;
int i;
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
xp = srcWidth / scaledWidth;
xq = srcWidth % scaledWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
yt = 0;
destPtr0 = dest->data;
for (y = 0; y < srcHeight; ++y) {
if ((yt += yq) >= srcHeight) {
yt -= srcHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
(*src)(srcData, lineBuf);
xt = 0;
d0 = (255 << 23) / xp;
d1 = (255 << 23) / (xp + 1);
xx = 0;
for (x = 0; x < scaledWidth; ++x) {
if ((xt += xq) >= scaledWidth) {
xt -= scaledWidth;
xStep = xp + 1;
d = d1;
} else {
xStep = xp;
d = d0;
}
pix = 0;
for (i = 0; i < xStep; ++i) {
pix += lineBuf[xx++];
}
pix = (pix * d) >> 23;
for (i = 0; i < yStep; ++i) {
destPtr = destPtr0 + i * scaledWidth + x;
*destPtr = (Guchar)pix;
}
}
destPtr0 += yStep * scaledWidth;
}
gfree(lineBuf);
}
| 4,142 | 13,982 |
88736844546603858307483990248549032532
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint pix;
Guchar *destPtr0, *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx;
int i, j;
destPtr0 = dest->data;
if (destPtr0 == NULL) {
error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXu");
return;
}
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
xp = scaledWidth / srcWidth;
xq = scaledWidth % srcWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
yt = 0;
for (y = 0; y < srcHeight; ++y) {
if ((yt += yq) >= srcHeight) {
yt -= srcHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
(*src)(srcData, lineBuf);
xt = 0;
xx = 0;
for (x = 0; x < srcWidth; ++x) {
if ((xt += xq) >= srcWidth) {
xt -= srcWidth;
xStep = xp + 1;
} else {
xStep = xp;
}
pix = lineBuf[x] ? 255 : 0;
for (i = 0; i < yStep; ++i) {
for (j = 0; j < xStep; ++j) {
destPtr = destPtr0 + i * scaledWidth + xx + j;
*destPtr++ = (Guchar)pix;
}
}
xx += xStep;
}
destPtr0 += yStep * scaledWidth;
}
gfree(lineBuf);
}
| 4,143 | 13,983 |
172587218735562914252266245449344950207
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::setOverprintMask(Guint overprintMask, GBool additive) {
state->overprintMask = overprintMask;
state->overprintAdditive = additive;
}
| 4,145 | 13,984 |
177966026090103052235467003157875852973
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::setOverprintMode(int opm) {
state->overprintMode = opm;
}
| 4,146 | 13,985 |
63804503654104661258225206248935127484
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::setStrokeOverprint(GBool gop) {
state->strokeOverprint = gop;
}
| 4,147 | 13,986 |
103975319963052205112151871117570554156
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue,
Guchar *gray) {
state->setTransfer(red, green, blue, gray);
}
| 4,148 | 13,987 |
208300420433997337654602991437495110144
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox,
SplashPattern *pattern) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes;
if (vectorAntialias && aaBuf == NULL) { // should not happen, but to be secure
return splashErrGeneric;
}
if (path->length == 0) {
return splashErrEmptyPath;
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
if (vectorAntialias) {
xPath->aaScale();
}
xPath->sort();
yMinI = state->clip->getYMinI();
yMaxI = state->clip->getYMaxI();
if (vectorAntialias && !inShading) {
yMinI = yMinI * splashAASize;
yMaxI = (yMaxI + 1) * splashAASize - 1;
}
scanner = new SplashXPathScanner(xPath, gFalse, yMinI, yMaxI);
if (vectorAntialias) {
scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI);
} else {
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
}
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) != splashClipAllOutside) {
if (yMinI < state->clip->getYMinI()) {
yMinI = state->clip->getYMinI();
}
if (yMaxI > state->clip->getYMaxI()) {
yMaxI = state->clip->getYMaxI();
}
pipeInit(&pipe, 0, yMinI, pattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), vectorAntialias && !hasBBox, gFalse);
if (vectorAntialias) {
for (y = yMinI; y <= yMaxI; ++y) {
scanner->renderAALine(aaBuf, &x0, &x1, y);
if (clipRes != splashClipAllInside) {
state->clip->clipAALine(aaBuf, &x0, &x1, y);
}
#if splashAASize == 4
if (!hasBBox && y > yMinI && y < yMaxI) {
Guchar *p0, *p1, *p2, *p3;
Guchar c1, c2, c3, c4;
p0 = aaBuf->getDataPtr() + (x0 >> 1);
p1 = p0 + aaBuf->getRowSize();
p2 = p1 + aaBuf->getRowSize();
p3 = p2 + aaBuf->getRowSize();
if (x0 & 1) {
c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f);
} else {
c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4);
}
if ( (c1 & 0x03) == 0x03 && (c2 & 0x03) == 0x03 && (c3 & 0x03) == 0x03 && (c4 & 0x03) == 0x03
&& c1 == c2 && c2 == c3 && c3 == c4 &&
pattern->testPosition(x0 - 1, y) )
{
Guchar shapeCorrection = (x0 & 1) ? 0x0f : 0xf0;
*p0 |= shapeCorrection;
*p1 |= shapeCorrection;
*p2 |= shapeCorrection;
*p3 |= shapeCorrection;
}
p0 = aaBuf->getDataPtr() + (x1 >> 1);
p1 = p0 + aaBuf->getRowSize();
p2 = p1 + aaBuf->getRowSize();
p3 = p2 + aaBuf->getRowSize();
if (x1 & 1) {
c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f);
} else {
c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4);
}
if ( (c1 & 0xc) == 0x0c && (c2 & 0x0c) == 0x0c && (c3 & 0x0c) == 0x0c && (c4 & 0x0c) == 0x0c
&& c1 == c2 && c2 == c3 && c3 == c4 &&
pattern->testPosition(x1 + 1, y) )
{
Guchar shapeCorrection = (x1 & 1) ? 0x0f : 0xf0;
*p0 |= shapeCorrection;
*p1 |= shapeCorrection;
*p2 |= shapeCorrection;
*p3 |= shapeCorrection;
}
}
#endif
drawAALine(&pipe, x0, x1, y);
}
} else {
SplashClipResult clipRes2;
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
}
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
| 4,149 | 13,988 |
16539090734049885159761744518915035011
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
SplashError Splash::stroke(SplashPath *path) {
SplashPath *path2, *dPath;
SplashCoord d1, d2, t1, t2, w;
if (debugMode) {
printf("stroke [dash:%d] [width:%.2f]:\n",
state->lineDashLength, (double)state->lineWidth);
dumpPath(path);
}
opClipRes = splashClipAllOutside;
if (path->length == 0) {
return splashErrEmptyPath;
}
path2 = flattenPath(path, state->matrix, state->flatness);
if (state->lineDashLength > 0) {
dPath = makeDashedPath(path2);
delete path2;
path2 = dPath;
if (path2->length == 0) {
delete path2;
return splashErrEmptyPath;
}
}
t1 = state->matrix[0] + state->matrix[2];
t2 = state->matrix[1] + state->matrix[3];
d1 = t1 * t1 + t2 * t2;
t1 = state->matrix[0] - state->matrix[2];
t2 = state->matrix[1] - state->matrix[3];
d2 = t1 * t1 + t2 * t2;
if (d2 > d1) {
d1 = d2;
}
d1 *= 0.5;
if (d1 > 0 &&
d1 * state->lineWidth * state->lineWidth < minLineWidth * minLineWidth) {
w = minLineWidth / splashSqrt(d1);
strokeWide(path2, w);
} else if (bitmap->mode == splashModeMono1) {
if (d1 * state->lineWidth <= 2) {
strokeNarrow(path2);
} else {
strokeWide(path2, state->lineWidth);
}
} else {
if (state->lineWidth == 0) {
strokeNarrow(path2);
} else {
strokeWide(path2, state->lineWidth);
}
}
delete path2;
return splashOk;
}
| 4,150 | 13,989 |
17457670276741737566520265729764142928
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::strokeNarrow(SplashPath *path) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathSeg *seg;
int x0, x1, y0, y1, xa, xb, y;
SplashCoord dxdy;
SplashClipResult clipRes;
int nClipRes[3];
int i;
nClipRes[0] = nClipRes[1] = nClipRes[2] = 0;
xPath = new SplashXPath(path, state->matrix, state->flatness, gFalse);
pipeInit(&pipe, 0, 0, state->strokePattern, NULL,
(Guchar)splashRound(state->strokeAlpha * 255),
gFalse, gFalse);
for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) {
if (seg->y0 <= seg->y1) {
y0 = splashFloor(seg->y0);
y1 = splashFloor(seg->y1);
x0 = splashFloor(seg->x0);
x1 = splashFloor(seg->x1);
} else {
y0 = splashFloor(seg->y1);
y1 = splashFloor(seg->y0);
x0 = splashFloor(seg->x1);
x1 = splashFloor(seg->x0);
}
if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0,
x0 <= x1 ? x1 : x0, y1))
!= splashClipAllOutside) {
if (y0 == y1) {
if (x0 <= x1) {
drawSpan(&pipe, x0, x1, y0, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, x1, x0, y0, clipRes == splashClipAllInside);
}
} else {
dxdy = seg->dxdy;
if (y0 < state->clip->getYMinI()) {
y0 = state->clip->getYMinI();
x0 = splashFloor(seg->x0 + ((SplashCoord)y0 - seg->y0) * dxdy);
}
if (y1 > state->clip->getYMaxI()) {
y1 = state->clip->getYMaxI();
x1 = splashFloor(seg->x0 + ((SplashCoord)y1 - seg->y0) * dxdy);
}
if (x0 <= x1) {
xa = x0;
for (y = y0; y <= y1; ++y) {
if (y < y1) {
xb = splashFloor(seg->x0 +
((SplashCoord)y + 1 - seg->y0) * dxdy);
} else {
xb = x1 + 1;
}
if (xa == xb) {
drawPixel(&pipe, xa, y, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, xa, xb - 1, y, clipRes == splashClipAllInside);
}
xa = xb;
}
} else {
xa = x0;
for (y = y0; y <= y1; ++y) {
if (y < y1) {
xb = splashFloor(seg->x0 +
((SplashCoord)y + 1 - seg->y0) * dxdy);
} else {
xb = x1 - 1;
}
if (xa == xb) {
drawPixel(&pipe, xa, y, clipRes == splashClipAllInside);
} else {
drawSpan(&pipe, xb + 1, xa, y, clipRes == splashClipAllInside);
}
xa = xb;
}
}
}
}
++nClipRes[clipRes];
}
if (nClipRes[splashClipPartial] ||
(nClipRes[splashClipAllInside] && nClipRes[splashClipAllOutside])) {
opClipRes = splashClipPartial;
} else if (nClipRes[splashClipAllInside]) {
opClipRes = splashClipAllInside;
} else {
opClipRes = splashClipAllOutside;
}
delete xPath;
}
| 4,151 | 13,990 |
172645296861949514256313021154432773686
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::strokeWide(SplashPath *path, SplashCoord w) {
SplashPath *path2;
path2 = makeStrokePath(path, w, gFalse);
fillWithPattern(path2, gFalse, state->strokePattern, state->strokeAlpha);
delete path2;
}
| 4,152 | 13,991 |
296678347658039467456788440001433464818
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
void Splash::vertFlipImage(SplashBitmap *img, int width, int height,
int nComps) {
Guchar *lineBuf;
Guchar *p0, *p1;
int w;
w = width * nComps;
lineBuf = (Guchar *)gmalloc(w);
for (p0 = img->data, p1 = img->data + (height - 1) * w;
p0 < p1;
p0 += w, p1 -= w) {
memcpy(lineBuf, p0, w);
memcpy(p0, p1, w);
memcpy(p1, lineBuf, w);
}
if (img->alpha) {
for (p0 = img->alpha, p1 = img->alpha + (height - 1) * width;
p0 < p1;
p0 += width, p1 -= width) {
memcpy(lineBuf, p0, width);
memcpy(p0, p1, width);
memcpy(p1, lineBuf, width);
}
}
gfree(lineBuf);
}
| 4,153 | 13,992 |
173881635335238555144777416453795398654
| null | null | null |
|
poppler
|
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
| 0 |
SplashError Splash::xorFill(SplashPath *path, GBool eo) {
SplashPipe pipe;
SplashXPath *xPath;
SplashXPathScanner *scanner;
int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y;
SplashClipResult clipRes, clipRes2;
SplashBlendFunc origBlendFunc;
if (path->length == 0) {
return splashErrEmptyPath;
}
xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue);
xPath->sort();
scanner = new SplashXPathScanner(xPath, eo, state->clip->getYMinI(),
state->clip->getYMaxI());
scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI);
if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI))
!= splashClipAllOutside) {
if (scanner->hasPartialClip()) {
clipRes = splashClipPartial;
}
origBlendFunc = state->blendFunc;
state->blendFunc = &blendXor;
pipeInit(&pipe, 0, yMinI, state->fillPattern, NULL, 255, gFalse, gFalse);
for (y = yMinI; y <= yMaxI; ++y) {
while (scanner->getNextSpan(y, &x0, &x1)) {
if (clipRes == splashClipAllInside) {
drawSpan(&pipe, x0, x1, y, gTrue);
} else {
if (x0 < state->clip->getXMinI()) {
x0 = state->clip->getXMinI();
}
if (x1 > state->clip->getXMaxI()) {
x1 = state->clip->getXMaxI();
}
clipRes2 = state->clip->testSpan(x0, x1, y);
drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside);
}
}
}
state->blendFunc = origBlendFunc;
}
opClipRes = clipRes;
delete scanner;
delete xPath;
return splashOk;
}
| 4,154 | 13,993 |
10910927582143465514093310402097698113
| null | null | null |
|
poppler
|
a205e71a2dbe0c8d4f4905a76a3f79ec522eacec
| 0 |
static inline int imgCoordMungeLower(SplashCoord x) {
return splashCeil(x + 0.5) - 1;
}
| 4,155 | 13,994 |
148892087862231685160615391334295189022
| null | null | null |
|
poppler
|
a205e71a2dbe0c8d4f4905a76a3f79ec522eacec
| 0 |
static inline int imgCoordMungeUpper(SplashCoord x) {
return splashCeil(x + 0.5) - 1;
}
| 4,156 | 13,995 |
84030816362664567070389488190332946249
| null | null | null |
|
poppler
|
8b6dc55e530b2f5ede6b9dfb64aafdd1d5836492
| 0 |
void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
SplashCoord *mat, GBool glyphMode) {
SplashBitmap *scaledMask;
SplashClipResult clipRes, clipRes2;
SplashPipe pipe;
int scaledWidth, scaledHeight, t0, t1;
SplashCoord r00, r01, r10, r11, det, ir00, ir01, ir10, ir11;
SplashCoord vx[4], vy[4];
int xMin, yMin, xMax, yMax;
ImageSection section[3];
int nSections;
int y, xa, xb, x, i, xx, yy;
vx[0] = mat[4]; vy[0] = mat[5];
vx[1] = mat[2] + mat[4]; vy[1] = mat[3] + mat[5];
vx[2] = mat[0] + mat[2] + mat[4]; vy[2] = mat[1] + mat[3] + mat[5];
vx[3] = mat[0] + mat[4]; vy[3] = mat[1] + mat[5];
xMin = imgCoordMungeLowerC(vx[0], glyphMode);
xMax = imgCoordMungeUpperC(vx[0], glyphMode);
yMin = imgCoordMungeLowerC(vy[0], glyphMode);
yMax = imgCoordMungeUpperC(vy[0], glyphMode);
for (i = 1; i < 4; ++i) {
t0 = imgCoordMungeLowerC(vx[i], glyphMode);
if (t0 < xMin) {
xMin = t0;
}
t0 = imgCoordMungeUpperC(vx[i], glyphMode);
if (t0 > xMax) {
xMax = t0;
}
t1 = imgCoordMungeLowerC(vy[i], glyphMode);
if (t1 < yMin) {
yMin = t1;
}
t1 = imgCoordMungeUpperC(vy[i], glyphMode);
if (t1 > yMax) {
yMax = t1;
}
}
clipRes = state->clip->testRect(xMin, yMin, xMax - 1, yMax - 1);
opClipRes = clipRes;
if (clipRes == splashClipAllOutside) {
return;
}
if (mat[0] >= 0) {
t0 = imgCoordMungeUpperC(mat[0] + mat[4], glyphMode) -
imgCoordMungeLowerC(mat[4], glyphMode);
} else {
t0 = imgCoordMungeUpperC(mat[4], glyphMode) -
imgCoordMungeLowerC(mat[0] + mat[4], glyphMode);
}
if (mat[1] >= 0) {
t1 = imgCoordMungeUpperC(mat[1] + mat[5], glyphMode) -
imgCoordMungeLowerC(mat[5], glyphMode);
} else {
t1 = imgCoordMungeUpperC(mat[5], glyphMode) -
imgCoordMungeLowerC(mat[1] + mat[5], glyphMode);
}
scaledWidth = t0 > t1 ? t0 : t1;
if (mat[2] >= 0) {
t0 = imgCoordMungeUpperC(mat[2] + mat[4], glyphMode) -
imgCoordMungeLowerC(mat[4], glyphMode);
} else {
t0 = imgCoordMungeUpperC(mat[4], glyphMode) -
imgCoordMungeLowerC(mat[2] + mat[4], glyphMode);
}
if (mat[3] >= 0) {
t1 = imgCoordMungeUpperC(mat[3] + mat[5], glyphMode) -
imgCoordMungeLowerC(mat[5], glyphMode);
} else {
t1 = imgCoordMungeUpperC(mat[5], glyphMode) -
imgCoordMungeLowerC(mat[3] + mat[5], glyphMode);
}
scaledHeight = t0 > t1 ? t0 : t1;
if (scaledWidth == 0) {
scaledWidth = 1;
}
if (scaledHeight == 0) {
scaledHeight = 1;
}
r00 = mat[0] / scaledWidth;
r01 = mat[1] / scaledWidth;
r10 = mat[2] / scaledHeight;
r11 = mat[3] / scaledHeight;
det = r00 * r11 - r01 * r10;
if (splashAbs(det) < 1e-6) {
return;
}
ir00 = r11 / det;
ir01 = -r01 / det;
ir10 = -r10 / det;
ir11 = r00 / det;
scaledMask = scaleMask(src, srcData, srcWidth, srcHeight,
scaledWidth, scaledHeight);
if (scaledMask->data == NULL) {
error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask");
delete scaledMask;
return;
}
i = (vy[2] <= vy[3]) ? 2 : 3;
if (vy[1] <= vy[i]) {
i = 1;
}
if (vy[0] < vy[i] || (i != 3 && vy[0] == vy[i])) {
i = 0;
}
if (vy[i] == vy[(i+1) & 3]) {
section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode);
section[0].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1;
if (vx[i] < vx[(i+1) & 3]) {
section[0].ia0 = i;
section[0].ia1 = (i+3) & 3;
section[0].ib0 = (i+1) & 3;
section[0].ib1 = (i+2) & 3;
} else {
section[0].ia0 = (i+1) & 3;
section[0].ia1 = (i+2) & 3;
section[0].ib0 = i;
section[0].ib1 = (i+3) & 3;
}
nSections = 1;
} else {
section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode);
section[2].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1;
section[0].ia0 = section[0].ib0 = i;
section[2].ia1 = section[2].ib1 = (i+2) & 3;
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[0].ia1 = section[2].ia0 = (i+1) & 3;
section[0].ib1 = section[2].ib0 = (i+3) & 3;
} else {
section[0].ia1 = section[2].ia0 = (i+3) & 3;
section[0].ib1 = section[2].ib0 = (i+1) & 3;
}
if (vy[(i+1) & 3] < vy[(i+3) & 3]) {
section[1].y0 = imgCoordMungeLowerC(vy[(i+1) & 3], glyphMode);
section[2].y0 = imgCoordMungeUpperC(vy[(i+3) & 3], glyphMode);
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[1].ia0 = (i+1) & 3;
section[1].ia1 = (i+2) & 3;
section[1].ib0 = i;
section[1].ib1 = (i+3) & 3;
} else {
section[1].ia0 = i;
section[1].ia1 = (i+3) & 3;
section[1].ib0 = (i+1) & 3;
section[1].ib1 = (i+2) & 3;
}
} else {
section[1].y0 = imgCoordMungeLowerC(vy[(i+3) & 3], glyphMode);
section[2].y0 = imgCoordMungeUpperC(vy[(i+1) & 3], glyphMode);
if (vx[(i+1) & 3] < vx[(i+3) & 3]) {
section[1].ia0 = i;
section[1].ia1 = (i+1) & 3;
section[1].ib0 = (i+3) & 3;
section[1].ib1 = (i+2) & 3;
} else {
section[1].ia0 = (i+3) & 3;
section[1].ia1 = (i+2) & 3;
section[1].ib0 = i;
section[1].ib1 = (i+1) & 3;
}
}
section[0].y1 = section[1].y0 - 1;
section[1].y1 = section[2].y0 - 1;
nSections = 3;
}
for (i = 0; i < nSections; ++i) {
section[i].xa0 = vx[section[i].ia0];
section[i].ya0 = vy[section[i].ia0];
section[i].xa1 = vx[section[i].ia1];
section[i].ya1 = vy[section[i].ia1];
section[i].xb0 = vx[section[i].ib0];
section[i].yb0 = vy[section[i].ib0];
section[i].xb1 = vx[section[i].ib1];
section[i].yb1 = vy[section[i].ib1];
section[i].dxdya = (section[i].xa1 - section[i].xa0) /
(section[i].ya1 - section[i].ya0);
section[i].dxdyb = (section[i].xb1 - section[i].xb0) /
(section[i].yb1 - section[i].yb0);
}
pipeInit(&pipe, 0, 0, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
if (vectorAntialias) {
drawAAPixelInit();
}
if (nSections == 1) {
if (section[0].y0 == section[0].y1) {
++section[0].y1;
clipRes = opClipRes = splashClipPartial;
}
} else {
if (section[0].y0 == section[2].y1) {
++section[1].y1;
clipRes = opClipRes = splashClipPartial;
}
}
for (i = 0; i < nSections; ++i) {
for (y = section[i].y0; y <= section[i].y1; ++y) {
xa = imgCoordMungeLowerC(section[i].xa0 +
((SplashCoord)y + 0.5 - section[i].ya0) *
section[i].dxdya,
glyphMode);
xb = imgCoordMungeUpperC(section[i].xb0 +
((SplashCoord)y + 0.5 - section[i].yb0) *
section[i].dxdyb,
glyphMode);
if (xa == xb) {
++xb;
}
if (clipRes != splashClipAllInside) {
clipRes2 = state->clip->testSpan(xa, xb - 1, y);
} else {
clipRes2 = clipRes;
}
for (x = xa; x < xb; ++x) {
xx = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir00 +
((SplashCoord)y + 0.5 - mat[5]) * ir10);
yy = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir01 +
((SplashCoord)y + 0.5 - mat[5]) * ir11);
if (xx < 0) {
xx = 0;
} else if (xx >= scaledWidth) {
xx = scaledWidth - 1;
}
if (yy < 0) {
yy = 0;
} else if (yy >= scaledHeight) {
yy = scaledHeight - 1;
}
pipe.shape = scaledMask->data[yy * scaledWidth + xx];
if (vectorAntialias && clipRes2 != splashClipAllInside) {
drawAAPixel(&pipe, x, y);
} else {
drawPixel(&pipe, x, y, clipRes2 == splashClipAllInside);
}
}
}
}
delete scaledMask;
}
|
CWE-119
| 4,164 | 14,001 |
53868594213493371618970960395395272534
| null | null | null |
poppler
|
8b6dc55e530b2f5ede6b9dfb64aafdd1d5836492
| 0 |
void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
SplashClipResult clipRes) {
SplashPipe pipe;
Guchar *p;
int w, h, x, y;
w = src->getWidth();
h = src->getHeight();
p = src->getDataPtr();
if (p == NULL) {
error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask");
return;
}
if (vectorAntialias && clipRes != splashClipAllInside) {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
drawAAPixelInit();
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
pipe.shape = *p++;
drawAAPixel(&pipe, xDest + x, yDest + y);
}
}
} else {
pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL,
(Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse);
if (clipRes == splashClipAllInside) {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
if (*p) {
pipe.shape = *p;
(this->*pipe.run)(&pipe);
} else {
pipeIncX(&pipe);
}
++p;
}
}
updateModX(xDest);
updateModX(xDest + w - 1);
updateModY(yDest);
updateModY(yDest + h - 1);
} else {
for (y = 0; y < h; ++y) {
pipeSetXY(&pipe, xDest, yDest + y);
for (x = 0; x < w; ++x) {
if (*p && state->clip->test(xDest + x, yDest + y)) {
pipe.shape = *p;
(this->*pipe.run)(&pipe);
updateModX(xDest + x);
updateModY(yDest + y);
} else {
pipeIncX(&pipe);
}
++p;
}
}
}
}
}
|
CWE-119
| 4,165 | 14,002 |
310125584350330314961525362143118479803
| null | null | null |
poppler
|
8b6dc55e530b2f5ede6b9dfb64aafdd1d5836492
| 0 |
void Splash::scaleMaskYdXu(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint *pixBuf;
Guint pix;
Guchar *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, d;
int i, j;
destPtr = dest->data;
if (destPtr == NULL) {
error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYdXu");
return;
}
yp = srcHeight / scaledHeight;
yq = srcHeight % scaledHeight;
xp = scaledWidth / srcWidth;
xq = scaledWidth % srcWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
pixBuf = (Guint *)gmallocn(srcWidth, sizeof(int));
yt = 0;
for (y = 0; y < scaledHeight; ++y) {
if ((yt += yq) >= scaledHeight) {
yt -= scaledHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
memset(pixBuf, 0, srcWidth * sizeof(int));
for (i = 0; i < yStep; ++i) {
(*src)(srcData, lineBuf);
for (j = 0; j < srcWidth; ++j) {
pixBuf[j] += lineBuf[j];
}
}
xt = 0;
d = (255 << 23) / yStep;
for (x = 0; x < srcWidth; ++x) {
if ((xt += xq) >= srcWidth) {
xt -= srcWidth;
xStep = xp + 1;
} else {
xStep = xp;
}
pix = pixBuf[x];
pix = (pix * d) >> 23;
for (i = 0; i < xStep; ++i) {
*destPtr++ = (Guchar)pix;
}
}
}
gfree(pixBuf);
gfree(lineBuf);
}
|
CWE-119
| 4,166 | 14,003 |
72877343906408334067683216455070174203
| null | null | null |
poppler
|
8b6dc55e530b2f5ede6b9dfb64aafdd1d5836492
| 0 |
void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint pix;
Guchar *destPtr0, *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1;
int i;
destPtr0 = dest->data;
if (destPtr0 == NULL) {
error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXd");
return;
}
yp = scaledHeight / srcHeight;
yq = scaledHeight % srcHeight;
xp = srcWidth / scaledWidth;
xq = srcWidth % scaledWidth;
lineBuf = (Guchar *)gmalloc(srcWidth);
yt = 0;
for (y = 0; y < srcHeight; ++y) {
if ((yt += yq) >= srcHeight) {
yt -= srcHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
(*src)(srcData, lineBuf);
xt = 0;
d0 = (255 << 23) / xp;
d1 = (255 << 23) / (xp + 1);
xx = 0;
for (x = 0; x < scaledWidth; ++x) {
if ((xt += xq) >= scaledWidth) {
xt -= scaledWidth;
xStep = xp + 1;
d = d1;
} else {
xStep = xp;
d = d0;
}
pix = 0;
for (i = 0; i < xStep; ++i) {
pix += lineBuf[xx++];
}
pix = (pix * d) >> 23;
for (i = 0; i < yStep; ++i) {
destPtr = destPtr0 + i * scaledWidth + x;
*destPtr = (Guchar)pix;
}
}
destPtr0 += yStep * scaledWidth;
}
gfree(lineBuf);
}
|
CWE-119
| 4,167 | 14,004 |
131271799793382102732150276167677064219
| null | null | null |
poppler
|
8b6dc55e530b2f5ede6b9dfb64aafdd1d5836492
| 0 |
void Splash::vertFlipImage(SplashBitmap *img, int width, int height,
int nComps) {
Guchar *lineBuf;
Guchar *p0, *p1;
int w;
if (unlikely(img->data == NULL)) {
error(errInternal, -1, "img->data is NULL in Splash::vertFlipImage");
return;
}
w = width * nComps;
lineBuf = (Guchar *)gmalloc(w);
for (p0 = img->data, p1 = img->data + (height - 1) * w;
p0 < p1;
p0 += w, p1 -= w) {
memcpy(lineBuf, p0, w);
memcpy(p0, p1, w);
memcpy(p1, lineBuf, w);
}
if (img->alpha) {
for (p0 = img->alpha, p1 = img->alpha + (height - 1) * width;
p0 < p1;
p0 += width, p1 -= width) {
memcpy(lineBuf, p0, width);
memcpy(p0, p1, width);
memcpy(p1, lineBuf, width);
}
}
gfree(lineBuf);
}
|
CWE-119
| 4,168 | 14,005 |
73968369994911783307750596585755966392
| null | null | null |
ghostscript
|
671fd59eb657743aa86fbc1895cb15872a317caa
| 0 |
ztoken(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
switch (r_type(op)) {
default:
return_op_typecheck(op);
case t_file: {
stream *s;
scanner_state state;
check_read_file(i_ctx_p, s, op);
check_ostack(1);
gs_scanner_init(&state, op);
return token_continue(i_ctx_p, &state, true);
}
case t_string: {
ref token;
/* -1 is to remove the string operand in case of error. */
int orig_ostack_depth = ref_stack_count(&o_stack) - 1;
int code;
/* Don't pop the operand in case of invalidaccess. */
if (!r_has_attr(op, a_read))
return_error(gs_error_invalidaccess);
code = gs_scan_string_token(i_ctx_p, op, &token);
switch (code) {
case scan_EOF: /* no tokens */
make_false(op);
return 0;
default:
if (code < 0) {
/*
* Clear anything that may have been left on the ostack,
* including the string operand.
*/
if (orig_ostack_depth < ref_stack_count(&o_stack))
pop(ref_stack_count(&o_stack)- orig_ostack_depth);
return code;
}
}
push(2);
op[-1] = token;
make_true(op);
return 0;
}
}
}
|
CWE-125
| 4,169 | 14,006 |
186060198617707044379868655936380518003
| null | null | null |
ghostscript
|
671fd59eb657743aa86fbc1895cb15872a317caa
| 0 |
ztoken_continue(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
scanner_state *pstate;
check_stype(*op, st_scanner_state_dynamic);
pstate = r_ptr(op, scanner_state);
return token_continue(i_ctx_p, pstate, false);
}
|
CWE-125
| 4,170 | 14,007 |
121537570233652110239280156270797089466
| null | null | null |
savannah
|
79972af4f0485a11dcb19551356c45245749fc5b
| 0 |
ft_smooth_init( FT_Renderer render )
{
FT_Library library = FT_MODULE_LIBRARY( render );
render->clazz->raster_class->raster_reset( render->raster,
library->raster_pool,
library->raster_pool_size );
return 0;
}
|
CWE-189
| 4,201 | 14,031 |
333930115796430182978452201260314449780
| null | null | null |
savannah
|
79972af4f0485a11dcb19551356c45245749fc5b
| 0 |
ft_smooth_render_lcd( FT_Renderer render,
FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin )
{
FT_Error error;
error = ft_smooth_render_generic( render, slot, mode, origin,
FT_RENDER_MODE_LCD );
if ( !error )
slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD;
return error;
}
|
CWE-189
| 4,203 | 14,032 |
332568802186551832585071198087418155079
| null | null | null |
savannah
|
79972af4f0485a11dcb19551356c45245749fc5b
| 0 |
ft_smooth_transform( FT_Renderer render,
FT_GlyphSlot slot,
const FT_Matrix* matrix,
const FT_Vector* delta )
{
FT_Error error = Smooth_Err_Ok;
if ( slot->format != render->glyph_format )
{
error = Smooth_Err_Invalid_Argument;
goto Exit;
}
if ( matrix )
FT_Outline_Transform( &slot->outline, matrix );
if ( delta )
FT_Outline_Translate( &slot->outline, delta->x, delta->y );
Exit:
return error;
}
|
CWE-189
| 4,206 | 14,033 |
326856207379722737934845797211209805049
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
CFF_Done_FD_Select( CFF_FDSelect fdselect,
FT_Stream stream )
{
if ( fdselect->data )
FT_FRAME_RELEASE( fdselect->data );
fdselect->data_size = 0;
fdselect->format = 0;
fdselect->range_count = 0;
}
|
CWE-189
| 4,207 | 14,034 |
16246825373085921206145191792657650378
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
CFF_Load_FD_Select( CFF_FDSelect fdselect,
FT_UInt num_glyphs,
FT_Stream stream,
FT_ULong offset )
{
FT_Error error;
FT_Byte format;
FT_UInt num_ranges;
/* read format */
if ( FT_STREAM_SEEK( offset ) || FT_READ_BYTE( format ) )
goto Exit;
fdselect->format = format;
fdselect->cache_count = 0; /* clear cache */
switch ( format )
{
case 0: /* format 0, that's simple */
fdselect->data_size = num_glyphs;
goto Load_Data;
case 3: /* format 3, a tad more complex */
if ( FT_READ_USHORT( num_ranges ) )
goto Exit;
fdselect->data_size = num_ranges * 3 + 2;
Load_Data:
if ( FT_FRAME_EXTRACT( fdselect->data_size, fdselect->data ) )
goto Exit;
break;
default: /* hmm... that's wrong */
error = CFF_Err_Invalid_File_Format;
}
Exit:
return error;
}
|
CWE-189
| 4,208 | 14,035 |
1035452282895958721500259827397834403
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_charset_compute_cids( CFF_Charset charset,
FT_UInt num_glyphs,
FT_Memory memory )
{
FT_Error error = FT_Err_Ok;
FT_UInt i;
FT_UShort max_cid = 0;
if ( charset->max_cid > 0 )
goto Exit;
for ( i = 0; i < num_glyphs; i++ )
if ( charset->sids[i] > max_cid )
max_cid = charset->sids[i];
max_cid++;
if ( FT_NEW_ARRAY( charset->cids, max_cid ) )
goto Exit;
for ( i = 0; i < num_glyphs; i++ )
charset->cids[charset->sids[i]] = (FT_UShort)i;
charset->max_cid = max_cid;
charset->num_glyphs = num_glyphs;
Exit:
return error;
}
|
CWE-189
| 4,209 | 14,036 |
181735454281632613445071450614992079706
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_charset_done( CFF_Charset charset,
FT_Stream stream )
{
FT_Memory memory = stream->memory;
cff_charset_free_cids( charset, memory );
FT_FREE( charset->sids );
charset->format = 0;
charset->offset = 0;
}
|
CWE-189
| 4,210 | 14,037 |
159808335612598445642570051881574834856
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_access_element( CFF_Index idx,
FT_UInt element,
FT_Byte** pbytes,
FT_ULong* pbyte_len )
{
FT_Error error = CFF_Err_Ok;
if ( idx && idx->count > element )
{
/* compute start and end offsets */
FT_Stream stream = idx->stream;
FT_ULong off1, off2 = 0;
/* load offsets from file or the offset table */
if ( !idx->offsets )
{
FT_ULong pos = element * idx->off_size;
if ( FT_STREAM_SEEK( idx->start + 3 + pos ) )
goto Exit;
off1 = cff_index_read_offset( idx, &error );
if ( error )
goto Exit;
if ( off1 != 0 )
{
do
{
element++;
off2 = cff_index_read_offset( idx, &error );
}
while ( off2 == 0 && element < idx->count );
}
}
else /* use offsets table */
{
off1 = idx->offsets[element];
if ( off1 )
{
do
{
element++;
off2 = idx->offsets[element];
} while ( off2 == 0 && element < idx->count );
}
}
/* access element */
if ( off1 && off2 > off1 )
{
*pbyte_len = off2 - off1;
if ( idx->bytes )
{
/* this index was completely loaded in memory, that's easy */
*pbytes = idx->bytes + off1 - 1;
}
else
{
/* this index is still on disk/file, access it through a frame */
if ( FT_STREAM_SEEK( idx->data_offset + off1 - 1 ) ||
FT_FRAME_EXTRACT( off2 - off1, *pbytes ) )
goto Exit;
}
}
else
{
/* empty index element */
*pbytes = 0;
*pbyte_len = 0;
}
}
else
error = CFF_Err_Invalid_Argument;
Exit:
return error;
}
|
CWE-189
| 4,214 | 14,038 |
285726082407551554953877792122323733110
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_done( CFF_Index idx )
{
if ( idx->stream )
{
FT_Stream stream = idx->stream;
FT_Memory memory = stream->memory;
if ( idx->bytes )
FT_FRAME_RELEASE( idx->bytes );
FT_FREE( idx->offsets );
FT_MEM_ZERO( idx, sizeof ( *idx ) );
}
}
|
CWE-189
| 4,215 | 14,039 |
28998855043956361231776217579150403185
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_forget_element( CFF_Index idx,
FT_Byte** pbytes )
{
if ( idx->bytes == 0 )
{
FT_Stream stream = idx->stream;
FT_FRAME_RELEASE( *pbytes );
}
}
|
CWE-189
| 4,216 | 14,040 |
281020700941670197494146098489945805065
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_get_name( CFF_Index idx,
FT_UInt element )
{
FT_Memory memory = idx->stream->memory;
FT_Byte* bytes;
FT_ULong byte_len;
FT_Error error;
FT_String* name = 0;
error = cff_index_access_element( idx, element, &bytes, &byte_len );
if ( error )
goto Exit;
if ( !FT_ALLOC( name, byte_len + 1 ) )
{
FT_MEM_COPY( name, bytes, byte_len );
name[byte_len] = 0;
}
cff_index_forget_element( idx, &bytes );
Exit:
return name;
}
|
CWE-189
| 4,217 | 14,041 |
206880918287827680549988963515523668560
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_get_pointers( CFF_Index idx,
FT_Byte*** table )
{
FT_Error error = CFF_Err_Ok;
FT_Memory memory = idx->stream->memory;
FT_ULong n, offset, old_offset;
FT_Byte** t;
*table = 0;
if ( idx->offsets == NULL )
{
error = cff_index_load_offsets( idx );
if ( error )
goto Exit;
}
if ( idx->count > 0 && !FT_NEW_ARRAY( t, idx->count + 1 ) )
{
old_offset = 1;
for ( n = 0; n <= idx->count; n++ )
{
/* at this point, `idx->offsets' can't be NULL */
offset = idx->offsets[n];
if ( !offset )
offset = old_offset;
/* two sanity checks for invalid offset tables */
else if ( offset < old_offset )
offset = old_offset;
else if ( offset - 1 >= idx->data_size && n < idx->count )
offset = old_offset;
t[n] = idx->bytes + offset - 1;
old_offset = offset;
}
*table = t;
}
Exit:
return error;
}
|
CWE-189
| 4,218 | 14,042 |
53156076161113569727548078944156905774
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_get_sid_string( CFF_Index idx,
FT_UInt sid,
FT_Service_PsCMaps psnames )
{
/* value 0xFFFFU indicates a missing dictionary entry */
if ( sid == 0xFFFFU )
return 0;
/* if it is not a standard string, return it */
if ( sid > 390 )
return cff_index_get_name( idx, sid - 391 );
/* CID-keyed CFF fonts don't have glyph names */
if ( !psnames )
return 0;
/* that's a standard string, fetch a copy from the PSName module */
{
FT_String* name = 0;
const char* adobe_name = psnames->adobe_std_strings( sid );
if ( adobe_name )
{
FT_Memory memory = idx->stream->memory;
FT_Error error;
(void)FT_STRDUP( name, adobe_name );
FT_UNUSED( error );
}
return name;
}
}
|
CWE-189
| 4,219 | 14,043 |
53787111964103082637115835470274424016
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_init( CFF_Index idx,
FT_Stream stream,
FT_Bool load )
{
FT_Error error;
FT_Memory memory = stream->memory;
FT_UShort count;
FT_MEM_ZERO( idx, sizeof ( *idx ) );
idx->stream = stream;
idx->start = FT_STREAM_POS();
if ( !FT_READ_USHORT( count ) &&
count > 0 )
{
FT_Byte offsize;
FT_ULong size;
/* there is at least one element; read the offset size, */
/* then access the offset table to compute the index's total size */
if ( FT_READ_BYTE( offsize ) )
goto Exit;
if ( offsize < 1 || offsize > 4 )
{
error = FT_Err_Invalid_Table;
goto Exit;
}
idx->count = count;
idx->off_size = offsize;
size = (FT_ULong)( count + 1 ) * offsize;
idx->data_offset = idx->start + 3 + size;
if ( FT_STREAM_SKIP( size - offsize ) )
goto Exit;
size = cff_index_read_offset( idx, &error );
if ( error )
goto Exit;
if ( size == 0 )
{
error = CFF_Err_Invalid_Table;
goto Exit;
}
idx->data_size = --size;
if ( load )
{
/* load the data */
if ( FT_FRAME_EXTRACT( size, idx->bytes ) )
goto Exit;
}
else
{
/* skip the data */
if ( FT_STREAM_SKIP( size ) )
goto Exit;
}
}
Exit:
if ( error )
FT_FREE( idx->offsets );
return error;
}
|
CWE-189
| 4,220 | 14,044 |
151190671554467487453905527614369543401
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_load_offsets( CFF_Index idx )
{
FT_Error error = CFF_Err_Ok;
FT_Stream stream = idx->stream;
FT_Memory memory = stream->memory;
if ( idx->count > 0 && idx->offsets == NULL )
{
FT_Byte offsize = idx->off_size;
FT_ULong data_size;
FT_Byte* p;
FT_Byte* p_end;
FT_ULong* poff;
data_size = (FT_ULong)( idx->count + 1 ) * offsize;
if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) ||
FT_STREAM_SEEK( idx->start + 3 ) ||
FT_FRAME_ENTER( data_size ) )
goto Exit;
poff = idx->offsets;
p = (FT_Byte*)stream->cursor;
p_end = p + data_size;
switch ( offsize )
{
case 1:
for ( ; p < p_end; p++, poff++ )
poff[0] = p[0];
break;
case 2:
for ( ; p < p_end; p += 2, poff++ )
poff[0] = FT_PEEK_USHORT( p );
break;
case 3:
for ( ; p < p_end; p += 3, poff++ )
poff[0] = FT_PEEK_OFF3( p );
break;
default:
for ( ; p < p_end; p += 4, poff++ )
poff[0] = FT_PEEK_ULONG( p );
}
FT_FRAME_EXIT();
}
Exit:
if ( error )
FT_FREE( idx->offsets );
return error;
}
|
CWE-189
| 4,221 | 14,045 |
288129415303749206005798472243347483757
| null | null | null |
savannah
|
0545ec1ca36b27cb928128870a83e5f668980bc5
| 0 |
cff_index_read_offset( CFF_Index idx,
FT_Error *errorp )
{
FT_Error error;
FT_Stream stream = idx->stream;
FT_Byte tmp[4];
FT_ULong result = 0;
if ( !FT_STREAM_READ( tmp, idx->off_size ) )
{
FT_Int nn;
for ( nn = 0; nn < idx->off_size; nn++ )
result = ( result << 8 ) | tmp[nn];
}
*errorp = error;
return result;
}
|
CWE-189
| 4,222 | 14,046 |
282304742809806218800728432532933475985
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
int add_argv(const char *what, int quoted)
{
DEBUGP("add_argv: %s\n", what);
if (what && newargc + 1 < ARRAY_SIZE(newargv)) {
newargv[newargc] = strdup(what);
newargvattr[newargc] = quoted;
newargv[++newargc] = NULL;
return 1;
} else {
xtables_error(PARAMETER_PROBLEM,
"Parser cannot handle more arguments\n");
}
}
|
CWE-119
| 4,232 | 14,050 |
162720684723775950619709370216004392170
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
int command_default(struct iptables_command_state *cs,
struct xtables_globals *gl)
{
struct xtables_rule_match *matchp;
struct xtables_match *m;
if (cs->target != NULL &&
(cs->target->parse != NULL || cs->target->x6_parse != NULL) &&
cs->c >= cs->target->option_offset &&
cs->c < cs->target->option_offset + XT_OPTION_OFFSET_SCALE) {
xtables_option_tpcall(cs->c, cs->argv, cs->invert,
cs->target, &cs->fw);
return 0;
}
for (matchp = cs->matches; matchp; matchp = matchp->next) {
m = matchp->match;
if (matchp->completed ||
(m->x6_parse == NULL && m->parse == NULL))
continue;
if (cs->c < matchp->match->option_offset ||
cs->c >= matchp->match->option_offset + XT_OPTION_OFFSET_SCALE)
continue;
xtables_option_mpcall(cs->c, cs->argv, cs->invert, m, &cs->fw);
return 0;
}
/* Try loading protocol */
m = load_proto(cs);
if (m != NULL) {
size_t size;
cs->proto_used = 1;
size = XT_ALIGN(sizeof(struct xt_entry_match)) + m->size;
m->m = xtables_calloc(1, size);
m->m->u.match_size = size;
strcpy(m->m->u.user.name, m->name);
m->m->u.user.revision = m->revision;
xs_init_match(m);
if (m->x6_options != NULL)
gl->opts = xtables_options_xfrm(gl->orig_opts,
gl->opts,
m->x6_options,
&m->option_offset);
else
gl->opts = xtables_merge_options(gl->orig_opts,
gl->opts,
m->extra_opts,
&m->option_offset);
if (gl->opts == NULL)
xtables_error(OTHER_PROBLEM, "can't alloc memory!");
optind--;
/* Indicate to rerun getopt *immediately* */
return 1;
}
if (cs->c == ':')
xtables_error(PARAMETER_PROBLEM, "option \"%s\" "
"requires an argument", cs->argv[optind-1]);
if (cs->c == '?')
xtables_error(PARAMETER_PROBLEM, "unknown option "
"\"%s\"", cs->argv[optind-1]);
xtables_error(PARAMETER_PROBLEM, "Unknown arg \"%s\"", optarg);
return 0;
}
|
CWE-119
| 4,233 | 14,051 |
33676885978020097126850203771942066301
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
struct xtables_match *load_proto(struct iptables_command_state *cs)
{
if (!should_load_proto(cs))
return NULL;
return find_proto(cs->protocol, XTF_TRY_LOAD,
cs->options & OPT_NUMERIC, &cs->matches);
}
|
CWE-119
| 4,236 | 14,052 |
129411396992575804596616987903367497145
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
int parse_counters(const char *string, struct xt_counters *ctr)
{
int ret;
if (!string)
return 0;
ret = sscanf(string, "[%llu:%llu]",
(unsigned long long *)&ctr->pcnt,
(unsigned long long *)&ctr->bcnt);
return ret == 2;
}
|
CWE-119
| 4,237 | 14,053 |
297908644461134731309762927411580675370
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
void parse_wait_interval(int argc, char *argv[], struct timeval *wait_interval)
{
const char *arg;
unsigned int usec;
int ret;
if (optarg)
arg = optarg;
else if (xs_has_arg(argc, argv))
arg = argv[optind++];
else
xtables_error(PARAMETER_PROBLEM, "wait interval value required");
ret = sscanf(arg, "%u", &usec);
if (ret == 1) {
if (usec > 999999)
xtables_error(PARAMETER_PROBLEM,
"too long usec wait %u > 999999 usec",
usec);
wait_interval->tv_sec = 0;
wait_interval->tv_usec = usec;
return;
}
xtables_error(PARAMETER_PROBLEM, "wait interval not numeric");
}
|
CWE-119
| 4,238 | 14,054 |
131444983154441045324316404593364872630
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
int parse_wait_time(int argc, char *argv[])
{
int wait = -1;
if (optarg) {
if (sscanf(optarg, "%i", &wait) != 1)
xtables_error(PARAMETER_PROBLEM,
"wait seconds not numeric");
} else if (xs_has_arg(argc, argv))
if (sscanf(argv[optind++], "%i", &wait) != 1)
xtables_error(PARAMETER_PROBLEM,
"wait seconds not numeric");
return wait;
}
|
CWE-119
| 4,239 | 14,055 |
8642189109324792263324117473521584013
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
proto_to_name(uint8_t proto, int nolookup)
{
unsigned int i;
if (proto && !nolookup) {
struct protoent *pent = getprotobynumber(proto);
if (pent)
return pent->p_name;
}
for (i = 0; xtables_chain_protos[i].name != NULL; ++i)
if (xtables_chain_protos[i].num == proto)
return xtables_chain_protos[i].name;
return NULL;
}
|
CWE-119
| 4,240 | 14,056 |
192746779829712721232914806613208226915
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
void save_argv(void)
{
unsigned int i;
while (oldargc)
free(oldargv[--oldargc]);
oldargc = newargc;
newargc = 0;
for (i = 0; i < oldargc; i++) {
oldargv[i] = newargv[i];
}
}
|
CWE-119
| 4,241 | 14,057 |
77957370754273642474159335173461134407
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
static bool should_load_proto(struct iptables_command_state *cs)
{
if (cs->protocol == NULL)
return false;
if (find_proto(cs->protocol, XTF_DONT_LOAD,
cs->options & OPT_NUMERIC, NULL) == NULL)
return true;
return !cs->proto_used;
}
|
CWE-119
| 4,242 | 14,058 |
274051001644225044700593244373960027273
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
static mainfunc_t subcmd_get(const char *cmd, const struct subcommand *cb)
{
for (; cb->name != NULL; ++cb)
if (strcmp(cb->name, cmd) == 0)
return cb->main;
return NULL;
}
|
CWE-119
| 4,243 | 14,059 |
50591564199938716342768928591502490373
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
int subcmd_main(int argc, char **argv, const struct subcommand *cb)
{
const char *cmd = basename(*argv);
mainfunc_t f = subcmd_get(cmd, cb);
if (f == NULL && argc > 1) {
/*
* Unable to find a main method for our command name?
* Let's try again with the first argument!
*/
++argv;
--argc;
f = subcmd_get(*argv, cb);
}
/* now we should have a valid function pointer */
if (f != NULL)
return f(argc, argv);
fprintf(stderr, "ERROR: No valid subcommand given.\nValid subcommands:\n");
for (; cb->name != NULL; ++cb)
fprintf(stderr, " * %s\n", cb->name);
exit(EXIT_FAILURE);
}
|
CWE-119
| 4,244 | 14,060 |
81269695548406430420448483690834784844
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
void xs_init_match(struct xtables_match *match)
{
if (match->udata_size != 0) {
/*
* As soon as a subsequent instance of the same match
* is used, e.g. "-m time -m time", the first instance
* is no longer reachable anyway, so we can free udata.
* Same goes for target.
*/
free(match->udata);
match->udata = calloc(1, match->udata_size);
if (match->udata == NULL)
xtables_error(RESOURCE_PROBLEM, "malloc");
}
if (match->init != NULL)
match->init(match->m);
}
|
CWE-119
| 4,246 | 14,061 |
316882609649434337555587948638267560119
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
void xs_init_target(struct xtables_target *target)
{
if (target->udata_size != 0) {
free(target->udata);
target->udata = calloc(1, target->udata_size);
if (target->udata == NULL)
xtables_error(RESOURCE_PROBLEM, "malloc");
}
if (target->init != NULL)
target->init(target->t);
}
|
CWE-119
| 4,247 | 14,062 |
54456866721453757320186331796063794531
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
static int xtables_lock(int wait, struct timeval *wait_interval)
{
struct timeval time_left, wait_time;
int fd, i = 0;
time_left.tv_sec = wait;
time_left.tv_usec = 0;
fd = open(XT_LOCK_NAME, O_CREAT, 0600);
if (fd < 0) {
fprintf(stderr, "Fatal: can't open lock file %s: %s\n",
XT_LOCK_NAME, strerror(errno));
return XT_LOCK_FAILED;
}
if (wait == -1) {
if (flock(fd, LOCK_EX) == 0)
return fd;
fprintf(stderr, "Can't lock %s: %s\n", XT_LOCK_NAME,
strerror(errno));
return XT_LOCK_BUSY;
}
while (1) {
if (flock(fd, LOCK_EX | LOCK_NB) == 0)
return fd;
else if (timercmp(&time_left, wait_interval, <))
return XT_LOCK_BUSY;
if (++i % 10 == 0) {
fprintf(stderr, "Another app is currently holding the xtables lock; "
"still %lds %ldus time ahead to have a chance to grab the lock...\n",
time_left.tv_sec, time_left.tv_usec);
}
wait_time = *wait_interval;
select(0, NULL, NULL, NULL, &wait_time);
timersub(&time_left, wait_interval, &time_left);
}
}
|
CWE-119
| 4,248 | 14,063 |
272542059682519425780537497723113339513
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
int xtables_lock_or_exit(int wait, struct timeval *wait_interval)
{
int lock = xtables_lock(wait, wait_interval);
if (lock == XT_LOCK_FAILED) {
xtables_free_opts(1);
exit(RESOURCE_PROBLEM);
}
if (lock == XT_LOCK_BUSY) {
fprintf(stderr, "Another app is currently holding the xtables lock. ");
if (wait == 0)
fprintf(stderr, "Perhaps you want to use the -w option?\n");
else
fprintf(stderr, "Stopped waiting after %ds.\n", wait);
xtables_free_opts(1);
exit(RESOURCE_PROBLEM);
}
return lock;
}
|
CWE-119
| 4,249 | 14,064 |
93497947127060652906798722433378238091
| null | null | null |
netfilter
|
2ae1099a42e6a0f06de305ca13a842ac83d4683e
| 0 |
void xtables_unlock(int lock)
{
if (lock >= 0)
close(lock);
}
|
CWE-119
| 4,250 | 14,065 |
6255170613108467958772916652877259870
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
account_type_from_pwent (struct passwd *pwent)
{
struct group *grp;
gint i;
if (pwent->pw_uid == 0) {
g_debug ("user is root so account type is administrator");
return ACCOUNT_TYPE_ADMINISTRATOR;
}
grp = getgrnam (ADMIN_GROUP);
if (grp == NULL) {
g_debug (ADMIN_GROUP " group not found");
return ACCOUNT_TYPE_STANDARD;
}
for (i = 0; grp->gr_mem[i] != NULL; i++) {
if (g_strcmp0 (grp->gr_mem[i], pwent->pw_name) == 0) {
return ACCOUNT_TYPE_ADMINISTRATOR;
}
}
return ACCOUNT_TYPE_STANDARD;
}
|
CWE-22
| 4,711 | 14,066 |
39326430275807138404186074927766509884
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
become_user (gpointer data)
{
struct passwd *pw = data;
if (pw == NULL ||
initgroups (pw->pw_name, pw->pw_gid) != 0 ||
setgid (pw->pw_gid) != 0 ||
setuid (pw->pw_uid) != 0) {
exit (1);
}
}
|
CWE-22
| 4,712 | 14,067 |
194823919778646063375129912916882857368
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
compute_object_path (User *user)
{
gchar *object_path;
object_path = g_strdup_printf ("/org/freedesktop/Accounts/User%lu",
(gulong) accounts_user_get_uid (ACCOUNTS_USER (user)));
return object_path;
}
|
CWE-22
| 4,713 | 14,068 |
260863659108403462603047094180451202166
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
move_extra_data (const gchar *old_name,
const gchar *new_name)
{
g_autofree gchar *old_filename = NULL;
g_autofree gchar *new_filename = NULL;
old_filename = g_build_filename (USERDIR,
old_name, NULL);
new_filename = g_build_filename (USERDIR,
new_name, NULL);
g_rename (old_filename, new_filename);
}
|
CWE-22
| 4,714 | 14,069 |
273419458062204669178439197092849042415
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
on_user_changed_timeout (User *user)
{
user->changed_timeout_id = 0;
accounts_user_emit_changed (ACCOUNTS_USER (user));
return G_SOURCE_REMOVE;
}
|
CWE-22
| 4,715 | 14,070 |
245692697222034403068889486694203577759
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
on_user_property_notify (User *user)
{
if (user->changed_timeout_id != 0)
return;
user->changed_timeout_id = g_timeout_add (250, (GSourceFunc) on_user_changed_timeout, user);
}
|
CWE-22
| 4,716 | 14,071 |
176629112429088123546755335389251191146
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
throw_error (GDBusMethodInvocation *context,
gint error_code,
const gchar *format,
...)
{
va_list args;
g_autofree gchar *message = NULL;
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
g_dbus_method_invocation_return_error (context, ERROR, error_code, "%s", message);
}
|
CWE-22
| 4,718 | 14,072 |
77123739619731005722576226260662700457
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_change_email_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *email = data;
if (g_strcmp0 (accounts_user_get_email (ACCOUNTS_USER (user)), email) != 0) {
accounts_user_set_email (ACCOUNTS_USER (user), email);
save_extra_data (user);
}
accounts_user_complete_set_email (ACCOUNTS_USER (user), context);
}
|
CWE-22
| 4,719 | 14,073 |
125775174497338510264668711355237551669
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_change_language_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *language = data;
if (g_strcmp0 (accounts_user_get_language (ACCOUNTS_USER (user)), language) != 0) {
accounts_user_set_language (ACCOUNTS_USER (user), language);
save_extra_data (user);
}
accounts_user_complete_set_language (ACCOUNTS_USER (user), context);
}
|
CWE-22
| 4,720 | 14,074 |
273741808729823997488066458968633721861
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_change_location_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *location = data;
if (g_strcmp0 (accounts_user_get_location (ACCOUNTS_USER (user)), location) != 0) {
accounts_user_set_location (ACCOUNTS_USER (user), location);
save_extra_data (user);
}
accounts_user_complete_set_location (ACCOUNTS_USER (user), context);
}
|
CWE-22
| 4,721 | 14,075 |
207127574345521277075438999457662462319
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_change_shell_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *shell = data;
g_autoptr(GError) error = NULL;
const gchar *argv[6];
if (g_strcmp0 (accounts_user_get_shell (ACCOUNTS_USER (user)), shell) != 0) {
sys_log (context,
"change shell of user '%s' (%d) to '%s'",
accounts_user_get_user_name (ACCOUNTS_USER (user)),
accounts_user_get_uid (ACCOUNTS_USER (user)),
shell);
argv[0] = "/usr/sbin/usermod";
argv[1] = "-s";
argv[2] = shell;
argv[3] = "--";
argv[4] = accounts_user_get_user_name (ACCOUNTS_USER (user));
argv[5] = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
}
accounts_user_set_shell (ACCOUNTS_USER (user), shell);
}
accounts_user_complete_set_shell (ACCOUNTS_USER (user), context);
}
|
CWE-22
| 4,723 | 14,076 |
307862992214178391571558736269418402100
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_change_user_name_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *name = data;
gchar *old_name;
g_autoptr(GError) error = NULL;
const gchar *argv[6];
if (g_strcmp0 (accounts_user_get_user_name (ACCOUNTS_USER (user)), name) != 0) {
old_name = g_strdup (accounts_user_get_user_name (ACCOUNTS_USER (user)));
sys_log (context,
"change name of user '%s' (%d) to '%s'",
old_name,
accounts_user_get_uid (ACCOUNTS_USER (user)),
name);
argv[0] = "/usr/sbin/usermod";
argv[1] = "-l";
argv[2] = name;
argv[3] = "--";
argv[4] = accounts_user_get_user_name (ACCOUNTS_USER (user));
argv[5] = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
}
accounts_user_set_user_name (ACCOUNTS_USER (user), name);
move_extra_data (old_name, name);
}
accounts_user_complete_set_user_name (ACCOUNTS_USER (user), context);
}
|
CWE-22
| 4,724 | 14,077 |
310183387764856280214799736016114243420
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_change_x_session_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *x_session = data;
if (g_strcmp0 (accounts_user_get_xsession (ACCOUNTS_USER (user)), x_session) != 0) {
accounts_user_set_xsession (ACCOUNTS_USER (user), x_session);
save_extra_data (user);
}
accounts_user_complete_set_xsession (ACCOUNTS_USER (user), context);
}
|
CWE-22
| 4,725 | 14,078 |
244844007740252381100323618318475098292
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_changed (User *user)
{
accounts_user_emit_changed (ACCOUNTS_USER (user));
}
|
CWE-22
| 4,726 | 14,079 |
64158597288451047108458560920110865959
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_extension_get_property (User *user,
Daemon *daemon,
GDBusInterfaceInfo *interface,
GDBusMethodInvocation *invocation)
{
const GDBusPropertyInfo *property = g_dbus_method_invocation_get_property_info (invocation);
g_autoptr(GVariant) value = NULL;
value = user_extension_get_value (user, interface, property);
if (value) {
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(v)", value));
}
else {
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Key '%s' is not set and has no default value",
property->name);
}
}
|
CWE-22
| 4,729 | 14,080 |
188375470006073386473065157852297275378
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_extension_get_value (User *user,
GDBusInterfaceInfo *interface,
const GDBusPropertyInfo *property)
{
const GVariantType *type = G_VARIANT_TYPE (property->signature);
GVariant *value;
g_autofree gchar *printed = NULL;
gint i;
/* First, try to get the value from the keyfile */
printed = g_key_file_get_value (user->keyfile, interface->name, property->name, NULL);
if (printed) {
value = g_variant_parse (type, printed, NULL, NULL, NULL);
if (value != NULL)
return value;
}
/* If that didn't work, try for a default value annotation */
for (i = 0; property->annotations && property->annotations[i]; i++) {
GDBusAnnotationInfo *annotation = property->annotations[i];
if (g_str_equal (annotation->key, "org.freedesktop.Accounts.DefaultValue.String")) {
if (g_str_equal (property->signature, "s"))
return g_variant_ref_sink (g_variant_new_string (annotation->value));
}
else if (g_str_equal (annotation->key, "org.freedesktop.Accounts.DefaultValue")) {
value = g_variant_parse (type, annotation->value, NULL, NULL, NULL);
if (value != NULL)
return value;
}
}
/* Nothing found... */
return NULL;
}
|
CWE-22
| 4,730 | 14,081 |
80665750204484033267820685827380613733
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_extension_method_call (GDBusConnection *connection,
const gchar *sender,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
User *user = user_data;
GDBusInterfaceInfo *iface_info;
const gchar *annotation_name;
const gchar *action_id;
gint uid;
gint i;
/* We don't allow method calls on extension interfaces, so we
* should only ever see property calls here.
*/
g_assert_cmpstr (interface_name, ==, "org.freedesktop.DBus.Properties");
/* Now get the real interface name */
g_variant_get_child (parameters, 0, "&s", &interface_name);
if (get_caller_uid (invocation, &uid) && (uid_t) uid == accounts_user_get_uid (ACCOUNTS_USER (user))) {
/* Operation on sender's own User object */
if (g_str_equal (method_name, "Set")) {
annotation_name = "org.freedesktop.Accounts.Authentication.ChangeOwn";
action_id = "org.freedesktop.accounts.change-own-user-data";
}
else {
annotation_name = "org.freedesktop.Accounts.Authentication.ReadOwn";
action_id = ""; /* reading allowed by default */
}
}
else {
/* Operation on someone else's User object */
if (g_str_equal (method_name, "Set")) {
annotation_name = "org.freedesktop.Accounts.Authentication.ChangeAny";
action_id = "org.freedesktop.accounts.user-administration";
}
else {
annotation_name = "org.freedesktop.Accounts.Authentication.ReadAny";
action_id = ""; /* reading allowed by default */
}
}
iface_info = g_hash_table_lookup (daemon_get_extension_ifaces (user->daemon), interface_name);
g_assert (iface_info != NULL);
for (i = 0; iface_info->annotations && iface_info->annotations[i]; i++) {
if (g_str_equal (iface_info->annotations[i]->key, annotation_name)) {
action_id = iface_info->annotations[i]->value;
break;
}
}
if (action_id[0] == '\0') {
/* Should always allow this call, so just do it now */
user_extension_authentication_done (user->daemon, user, invocation, iface_info);
}
else {
daemon_local_check_auth (user->daemon, user, action_id, TRUE,
user_extension_authentication_done,
invocation, iface_info, NULL);
}
}
|
CWE-22
| 4,731 | 14,082 |
206831850210362520934483839274614013324
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_extension_set_property (User *user,
Daemon *daemon,
GDBusInterfaceInfo *interface,
GDBusMethodInvocation *invocation)
{
const GDBusPropertyInfo *property = g_dbus_method_invocation_get_property_info (invocation);
g_autoptr(GVariant) value = NULL;
g_autofree gchar *printed = NULL;
g_autofree gchar *prev = NULL;
g_variant_get_child (g_dbus_method_invocation_get_parameters (invocation), 2, "v", &value);
/* We'll always have the type when we parse it back so
* we don't need it to be printed with annotations.
*/
printed = g_variant_print (value, FALSE);
/* May as well try to avoid the thrashing... */
prev = g_key_file_get_value (user->keyfile, interface->name, property->name, NULL);
if (!prev || !g_str_equal (printed, prev)) {
g_key_file_set_value (user->keyfile, interface->name, property->name, printed);
/* Emit a change signal. Use invalidation
* because the data may not be world-readable.
*/
g_dbus_connection_emit_signal (g_dbus_method_invocation_get_connection (invocation),
NULL, /* destination_bus_name */
g_dbus_method_invocation_get_object_path (invocation),
"org.freedesktop.DBus.Properties", "PropertiesChanged",
g_variant_new_parsed ("( %s, %a{sv}, [ %s ] )",
interface->name, NULL, property->name),
NULL);
accounts_user_emit_changed (ACCOUNTS_USER (user));
save_extra_data (user);
}
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
}
|
CWE-22
| 4,732 | 14,083 |
190183611934001306003678523092841670504
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_cached (User *user)
{
return user->cached;
}
|
CWE-22
| 4,733 | 14,084 |
339469545157022913435461644879946912423
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_local_account (User *user)
{
return accounts_user_get_local_account (ACCOUNTS_USER (user));;
}
|
CWE-22
| 4,734 | 14,085 |
18999398490271697814537684345639121124
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_object_path (User *user)
{
return g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (user));
}
|
CWE-22
| 4,735 | 14,086 |
324422271745622849526250787657437062554
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_password_expiration_policy (AccountsUser *auser,
GDBusMethodInvocation *context)
{
User *user = (User*)auser;
int uid;
const gchar *action_id;
if (!get_caller_uid (context, &uid)) {
throw_error (context, ERROR_FAILED, "identifying caller failed");
return FALSE;
}
if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
action_id = "org.freedesktop.accounts.change-own-user-data";
else
action_id = "org.freedesktop.accounts.user-administration";
daemon_local_check_auth (user->daemon,
user,
action_id,
TRUE,
user_get_password_expiration_policy_authorized_cb,
context,
NULL,
NULL);
return TRUE;
}
|
CWE-22
| 4,736 | 14,087 |
302108569165661912899165028656405325042
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_password_expiration_policy_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
if (!user->account_expiration_policy_known) {
throw_error (context, ERROR_NOT_SUPPORTED, "account expiration policy unknown to accounts service");
return;
}
accounts_user_complete_get_password_expiration_policy (ACCOUNTS_USER (user),
context,
user->expiration_time,
user->last_change_time,
user->min_days_between_changes,
user->max_days_between_changes,
user->days_to_warn,
user->days_after_expiration_until_lock);
}
|
CWE-22
| 4,737 | 14,088 |
168371657731584108278025666588667593150
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_shell(User *user)
{
return accounts_user_get_shell (ACCOUNTS_USER (user));
}
|
CWE-22
| 4,738 | 14,089 |
216444429414257338681992191464029388184
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_system_account (User *user)
{
return accounts_user_get_system_account (ACCOUNTS_USER (user));
}
|
CWE-22
| 4,739 | 14,090 |
220127698156697423155246194276323518138
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_uid (User *user)
{
return accounts_user_get_uid (ACCOUNTS_USER (user));
}
|
CWE-22
| 4,740 | 14,091 |
95913204745355807844209930189041899009
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_get_user_name (User *user)
{
return accounts_user_get_user_name (ACCOUNTS_USER (user));
}
|
CWE-22
| 4,741 | 14,092 |
229152589638390942554214867028263222236
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_new (Daemon *daemon,
uid_t uid)
{
User *user;
user = g_object_new (TYPE_USER, NULL);
user->daemon = daemon;
accounts_user_set_uid (ACCOUNTS_USER (user), uid);
return user;
}
|
CWE-22
| 4,742 | 14,093 |
46636584897342277077576765669155771804
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_register (User *user)
{
g_autoptr(GError) error = NULL;
g_autofree gchar *object_path = NULL;
user->system_bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (user->system_bus_connection == NULL) {
if (error != NULL)
g_critical ("error getting system bus: %s", error->message);
return;
}
object_path = compute_object_path (user);
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (user),
user->system_bus_connection,
object_path,
&error)) {
if (error != NULL)
g_critical ("error exporting user object: %s", error->message);
return;
}
user_register_extensions (user);
g_signal_connect (G_OBJECT (user), "notify", G_CALLBACK (on_user_property_notify), NULL);
}
|
CWE-22
| 4,743 | 14,094 |
289846237182679978885668666225579523662
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_register_extensions (User *user)
{
static const GDBusInterfaceVTable vtable = {
user_extension_method_call,
NULL /* get_property */,
NULL /* set_property */
};
GHashTable *extensions;
GHashTableIter iter;
gpointer iface;
gint i = 0;
g_assert (user->extension_ids == NULL);
g_assert (user->n_extension_ids == 0);
extensions = daemon_get_extension_ifaces (user->daemon);
user->n_extension_ids = g_hash_table_size (extensions);
user->extension_ids = g_new (guint, user->n_extension_ids);
g_hash_table_iter_init (&iter, extensions);
/* Ignore errors when registering more interfaces because (a)
* they won't happen and (b) even if they do, we still want to
* publish the main user interface.
*/
while (g_hash_table_iter_next (&iter, NULL, &iface))
user->extension_ids[i++] = g_dbus_connection_register_object (user->system_bus_connection,
g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (user)), iface,
&vtable, user, NULL, NULL);
}
|
CWE-22
| 4,744 | 14,095 |
261771619278714587138482669802283968909
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_reset_icon_file (User *user)
{
const char *icon_file;
gboolean icon_is_default;
const char *home_dir;
icon_file = accounts_user_get_icon_file (ACCOUNTS_USER (user));
if (icon_file == NULL || g_strcmp0 (icon_file, user->default_icon_file) == 0) {
icon_is_default = TRUE;
} else {
icon_is_default = FALSE;
}
g_free (user->default_icon_file);
home_dir = accounts_user_get_home_directory (ACCOUNTS_USER (user));
user->default_icon_file = g_build_filename (home_dir, ".face", NULL);
if (icon_is_default) {
accounts_user_set_icon_file (ACCOUNTS_USER (user), user->default_icon_file);
}
}
|
CWE-22
| 4,745 | 14,096 |
226630585675615738135473439409975143609
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_save (User *user)
{
save_extra_data (user);
}
|
CWE-22
| 4,746 | 14,097 |
215777660546480461393683817652446204853
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_save_to_keyfile (User *user,
GKeyFile *keyfile)
{
g_key_file_remove_group (keyfile, "User", NULL);
if (accounts_user_get_email (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "Email", accounts_user_get_email (ACCOUNTS_USER (user)));
if (accounts_user_get_language (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "Language", accounts_user_get_language (ACCOUNTS_USER (user)));
if (accounts_user_get_xsession (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "XSession", accounts_user_get_xsession (ACCOUNTS_USER (user)));
if (accounts_user_get_location (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "Location", accounts_user_get_location (ACCOUNTS_USER (user)));
if (accounts_user_get_password_hint (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "PasswordHint", accounts_user_get_password_hint (ACCOUNTS_USER (user)));
if (accounts_user_get_icon_file (ACCOUNTS_USER (user)))
g_key_file_set_string (keyfile, "User", "Icon", accounts_user_get_icon_file (ACCOUNTS_USER (user)));
g_key_file_set_boolean (keyfile, "User", "SystemAccount", accounts_user_get_system_account (ACCOUNTS_USER (user)));
user_set_cached (user, TRUE);
}
|
CWE-22
| 4,747 | 14,098 |
143160279148006515438341844625001137334
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_cached (User *user,
gboolean cached)
{
user->cached = cached;
}
|
CWE-22
| 4,748 | 14,099 |
93835444693327076350097108820266017917
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_email (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *email)
{
User *user = (User*)auser;
int uid;
const gchar *action_id;
if (!get_caller_uid (context, &uid)) {
throw_error (context, ERROR_FAILED, "identifying caller failed");
return FALSE;
}
if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
action_id = "org.freedesktop.accounts.change-own-user-data";
else
action_id = "org.freedesktop.accounts.user-administration";
daemon_local_check_auth (user->daemon,
user,
action_id,
TRUE,
user_change_email_authorized_cb,
context,
g_strdup (email),
(GDestroyNotify)g_free);
return TRUE;
}
|
CWE-22
| 4,749 | 14,100 |
202056304285824829101688545691570005366
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_home_directory (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *home_dir)
{
User *user = (User*)auser;
daemon_local_check_auth (user->daemon,
user,
"org.freedesktop.accounts.user-administration",
TRUE,
user_change_home_dir_authorized_cb,
context,
g_strdup (home_dir),
(GDestroyNotify)g_free);
return TRUE;
}
|
CWE-22
| 4,750 | 14,101 |
212453878884401257435397323521378881718
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_language (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *language)
{
User *user = (User*)auser;
int uid;
const gchar *action_id;
if (!get_caller_uid (context, &uid)) {
throw_error (context, ERROR_FAILED, "identifying caller failed");
return FALSE;
}
if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
action_id = "org.freedesktop.accounts.change-own-user-data";
else
action_id = "org.freedesktop.accounts.user-administration";
daemon_local_check_auth (user->daemon,
user,
action_id,
TRUE,
user_change_language_authorized_cb,
context,
g_strdup (language),
(GDestroyNotify)g_free);
return TRUE;
}
|
CWE-22
| 4,751 | 14,102 |
190886607344552526367716480232882759247
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_location (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *location)
{
User *user = (User*)auser;
int uid;
const gchar *action_id;
if (!get_caller_uid (context, &uid)) {
throw_error (context, ERROR_FAILED, "identifying caller failed");
return FALSE;
}
if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
action_id = "org.freedesktop.accounts.change-own-user-data";
else
action_id = "org.freedesktop.accounts.user-administration";
daemon_local_check_auth (user->daemon,
user,
action_id,
TRUE,
user_change_location_authorized_cb,
context,
g_strdup (location),
(GDestroyNotify)g_free);
return TRUE;
}
|
CWE-22
| 4,752 | 14,103 |
3025851872292114687207586882359905274
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_real_name (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *real_name)
{
User *user = (User*)auser;
int uid;
const gchar *action_id;
if (!get_caller_uid (context, &uid)) {
throw_error (context, ERROR_FAILED, "identifying caller failed");
return FALSE;
}
if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
action_id = "org.freedesktop.accounts.change-own-user-data";
else
action_id = "org.freedesktop.accounts.user-administration";
daemon_local_check_auth (user->daemon,
user,
action_id,
TRUE,
user_change_real_name_authorized_cb,
context,
g_strdup (real_name),
(GDestroyNotify)g_free);
return TRUE;
}
|
CWE-22
| 4,753 | 14,104 |
317444593625086210325796282999024297407
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_shell (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *shell)
{
User *user = (User*)auser;
daemon_local_check_auth (user->daemon,
user,
"org.freedesktop.accounts.user-administration",
TRUE,
user_change_shell_authorized_cb,
context,
g_strdup (shell),
(GDestroyNotify)g_free);
return TRUE;
}
|
CWE-22
| 4,754 | 14,105 |
90099126044317613317015313198442425533
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_user_name (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *user_name)
{
User *user = (User*)auser;
daemon_local_check_auth (user->daemon,
user,
"org.freedesktop.accounts.user-administration",
TRUE,
user_change_user_name_authorized_cb,
context,
g_strdup (user_name),
(GDestroyNotify)g_free);
return TRUE;
}
|
CWE-22
| 4,755 | 14,106 |
25525954407716892776428791755096845571
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_set_x_session (AccountsUser *auser,
GDBusMethodInvocation *context,
const gchar *x_session)
{
User *user = (User*)auser;
int uid;
const gchar *action_id;
if (!get_caller_uid (context, &uid)) {
throw_error (context, ERROR_FAILED, "identifying caller failed");
return FALSE;
}
if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
action_id = "org.freedesktop.accounts.change-own-user-data";
else
action_id = "org.freedesktop.accounts.user-administration";
daemon_local_check_auth (user->daemon,
user,
action_id,
TRUE,
user_change_x_session_authorized_cb,
context,
g_strdup (x_session),
(GDestroyNotify) g_free);
return TRUE;
}
|
CWE-22
| 4,756 | 14,107 |
261395270350669540447123119025951805287
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_update_from_pwent (User *user,
struct passwd *pwent,
struct spwd *spent)
{
g_autofree gchar *real_name = NULL;
gboolean is_system_account;
const gchar *passwd;
gboolean locked;
PasswordMode mode;
AccountType account_type;
g_object_freeze_notify (G_OBJECT (user));
if (pwent->pw_gecos && pwent->pw_gecos[0] != '\0') {
gchar *first_comma = NULL;
gchar *valid_utf8_name = NULL;
if (g_utf8_validate (pwent->pw_gecos, -1, NULL)) {
valid_utf8_name = pwent->pw_gecos;
first_comma = g_utf8_strchr (valid_utf8_name, -1, ',');
}
else {
g_warning ("User %s has invalid UTF-8 in GECOS field. "
"It would be a good thing to check /etc/passwd.",
pwent->pw_name ? pwent->pw_name : "");
}
if (first_comma) {
real_name = g_strndup (valid_utf8_name,
(first_comma - valid_utf8_name));
}
else if (valid_utf8_name) {
real_name = g_strdup (valid_utf8_name);
}
else {
real_name = NULL;
}
if (real_name && real_name[0] == '\0') {
g_clear_pointer (&real_name, g_free);
}
}
else {
real_name = NULL;
}
accounts_user_set_real_name (ACCOUNTS_USER (user), real_name);
accounts_user_set_uid (ACCOUNTS_USER (user), pwent->pw_uid);
user->gid = pwent->pw_gid;
account_type = account_type_from_pwent (pwent);
accounts_user_set_account_type (ACCOUNTS_USER (user), account_type);
accounts_user_set_user_name (ACCOUNTS_USER (user), pwent->pw_name);
accounts_user_set_home_directory (ACCOUNTS_USER (user), pwent->pw_dir);
user_reset_icon_file (user);
accounts_user_set_shell (ACCOUNTS_USER (user), pwent->pw_shell);
passwd = NULL;
if (spent)
passwd = spent->sp_pwdp;
if (passwd && passwd[0] == '!') {
locked = TRUE;
}
else {
locked = FALSE;
}
accounts_user_set_locked (ACCOUNTS_USER (user), locked);
if (passwd == NULL || passwd[0] != 0) {
mode = PASSWORD_MODE_REGULAR;
}
else {
mode = PASSWORD_MODE_NONE;
}
if (spent) {
if (spent->sp_lstchg == 0) {
mode = PASSWORD_MODE_SET_AT_LOGIN;
}
user->expiration_time = spent->sp_expire;
user->last_change_time = spent->sp_lstchg;
user->min_days_between_changes = spent->sp_min;
user->max_days_between_changes = spent->sp_max;
user->days_to_warn = spent->sp_warn;
user->days_after_expiration_until_lock = spent->sp_inact;
user->account_expiration_policy_known = TRUE;
}
accounts_user_set_password_mode (ACCOUNTS_USER (user), mode);
is_system_account = !user_classify_is_human (accounts_user_get_uid (ACCOUNTS_USER (user)),
accounts_user_get_user_name (ACCOUNTS_USER (user)),
accounts_user_get_shell (ACCOUNTS_USER (user)),
passwd);
accounts_user_set_system_account (ACCOUNTS_USER (user), is_system_account);
g_object_thaw_notify (G_OBJECT (user));
}
|
CWE-22
| 4,758 | 14,108 |
298597407408596127481023926065838593578
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_update_local_account_property (User *user,
gboolean local)
{
accounts_user_set_local_account (ACCOUNTS_USER (user), local);
}
|
CWE-22
| 4,759 | 14,109 |
184184782023301654843089184964418232796
| null | null | null |
accountsservice
|
f9abd359f71a5bce421b9ae23432f539a067847a
| 0 |
user_update_system_account_property (User *user,
gboolean system)
{
accounts_user_set_system_account (ACCOUNTS_USER (user), system);
}
|
CWE-22
| 4,760 | 14,110 |
244445600182306699909848175683547168730
| null | null | null |
xserver
|
05442de962d3dc624f79fc1a00eca3ffc5489ced
| 0 |
ProcXSendExtensionEvent(ClientPtr client)
{
int ret;
DeviceIntPtr dev;
xEvent *first;
XEventClass *list;
struct tmask tmp[EMASKSIZE];
REQUEST(xSendExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
if (stuff->length !=
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
return BadLength;
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
if (ret != Success)
return ret;
if (stuff->num_events == 0)
return ret;
/* The client's event type must be one defined by an extension. */
first = ((xEvent *) &stuff[1]);
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
(first->u.u.type < lastEvent))) {
client->errorValue = first->u.u.type;
return BadValue;
}
list = (XEventClass *) (first + stuff->num_events);
if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
X_SendExtensionEvent)) != Success)
return ret;
ret = (SendEvent(client, dev, stuff->destination,
stuff->propagate, (xEvent *) &stuff[1],
tmp[stuff->deviceid].mask, stuff->num_events));
return ret;
}
|
CWE-665
| 4,784 | 14,133 |
16354133801685040227164661137860092520
| null | null | null |
xserver
|
215f894965df5fb0bb45b107d84524e700d2073c
| 0 |
ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
{
BOOL rc = FALSE;
DeviceEvent event;
if (dev->deviceGrab.grab) {
if (!dev->deviceGrab.fromPassiveGrab ||
dev->deviceGrab.grab->type != XI_Enter ||
dev->deviceGrab.grab->window == win ||
IsParent(dev->deviceGrab.grab->window, win))
return FALSE;
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
(*dev->deviceGrab.DeactivateGrab) (dev);
}
event = (DeviceEvent) {
.header = ET_Internal,
.type = ET_Enter,
.length = sizeof(DeviceEvent),
.time = GetTimeInMillis(),
.deviceid = dev->id,
.sourceid = dev->id,
.detail.button = 0
};
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
TRUE) != NULL);
if (rc)
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab);
return rc;
}
|
CWE-119
| 4,785 | 14,134 |
310764000798863795509643453416873044938
| null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.