idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
9,000
asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, unsigned int flags, char *errorDescription) { asn1_node node, p, p2, p3; char temp[128]; int counter, len2, len3, len4, move, ris, tlen; struct node_tail_cache_st tcache = {NULL, NULL}; unsigned char class; unsigned long tag; int tag_len; int indefinite, result, total_len = *max_ider_len, ider_len = *max_ider_len; int inner_tag_len; const unsigned char *der = ider; node = *element; if (errorDescription != NULL) errorDescription[0] = 0; if (node == NULL) return ASN1_ELEMENT_NOT_FOUND; if (node->type & CONST_OPTION) { result = ASN1_GENERIC_ERROR; warn(); goto cleanup; } counter = 0; move = DOWN; p = node; while (1) { tag_len = 0; inner_tag_len = 0; ris = ASN1_SUCCESS; if (move != UP) { if (p->type & CONST_SET) { p2 = _asn1_find_up (p); len2 = p2->tmp_ival; if (len2 == -1) { if (HAVE_TWO(ider_len) && !der[counter] && !der[counter + 1]) { p = p2; move = UP; counter += 2; DECR_LEN(ider_len, 2); continue; } } else if (counter == len2) { p = p2; move = UP; continue; } else if (counter > len2) { result = ASN1_DER_ERROR; warn(); goto cleanup; } p2 = p2->down; while (p2) { if ((p2->type & CONST_SET) && (p2->type & CONST_NOT_USED)) { ris = extract_tag_der_recursive (p2, der + counter, ider_len, &len2, NULL, flags); if (ris == ASN1_SUCCESS) { p2->type &= ~CONST_NOT_USED; p = p2; break; } } p2 = p2->right; } if (p2 == NULL) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } /* the position in the DER structure this starts */ p->start = counter; p->end = total_len - 1; if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT)) { p2 = _asn1_find_up (p); len2 = p2->tmp_ival; if (counter == len2) { if (p->right) { p2 = p->right; move = RIGHT; } else move = UP; if (p->type & CONST_OPTION) asn1_delete_structure (&p); p = p2; continue; } } if (type_field (p->type) == ASN1_ETYPE_CHOICE) { while (p->down) { ris = extract_tag_der_recursive (p->down, der + counter, ider_len, &len2, NULL, flags); if (ris == ASN1_SUCCESS) { delete_unneeded_choice_fields(p->down); break; } else if (ris == ASN1_ERROR_TYPE_ANY) { result = ASN1_ERROR_TYPE_ANY; warn(); goto cleanup; } else { p2 = p->down; asn1_delete_structure (&p2); } } if (p->down == NULL) { if (!(p->type & CONST_OPTION)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } else if (type_field (p->type) != ASN1_ETYPE_CHOICE) p = p->down; p->start = counter; } if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT)) { p2 = _asn1_find_up (p); len2 = p2->tmp_ival; if ((len2 != -1) && (counter > len2)) ris = ASN1_TAG_ERROR; } if (ris == ASN1_SUCCESS) ris = extract_tag_der_recursive (p, der + counter, ider_len, &tag_len, &inner_tag_len, flags); if (ris != ASN1_SUCCESS) { if (p->type & CONST_OPTION) { p->type |= CONST_NOT_USED; move = RIGHT; } else if (p->type & CONST_DEFAULT) { _asn1_set_value (p, NULL, 0); move = RIGHT; } else { if (errorDescription != NULL) _asn1_error_description_tag_error (p, errorDescription); result = ASN1_TAG_ERROR; warn(); goto cleanup; } } else { DECR_LEN(ider_len, tag_len); counter += tag_len; } } if (ris == ASN1_SUCCESS) { switch (type_field (p->type)) { case ASN1_ETYPE_NULL: DECR_LEN(ider_len, 1); if (der[counter]) { result = ASN1_DER_ERROR; warn(); goto cleanup; } counter++; move = RIGHT; break; case ASN1_ETYPE_BOOLEAN: DECR_LEN(ider_len, 2); if (der[counter++] != 1) { result = ASN1_DER_ERROR; warn(); goto cleanup; } if (der[counter++] == 0) _asn1_set_value (p, "F", 1); else _asn1_set_value (p, "T", 1); move = RIGHT; break; case ASN1_ETYPE_INTEGER: case ASN1_ETYPE_ENUMERATED: len2 = asn1_get_length_der (der + counter, ider_len, &len3); if (len2 < 0) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len3+len2); _asn1_set_value (p, der + counter, len3 + len2); counter += len3 + len2; move = RIGHT; break; case ASN1_ETYPE_OBJECT_ID: result = asn1_get_object_id_der (der + counter, ider_len, &len2, temp, sizeof (temp)); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len2); tlen = strlen (temp); if (tlen > 0) _asn1_set_value (p, temp, tlen + 1); counter += len2; move = RIGHT; break; case ASN1_ETYPE_GENERALIZED_TIME: case ASN1_ETYPE_UTC_TIME: result = _asn1_get_time_der (type_field (p->type), der + counter, ider_len, &len2, temp, sizeof (temp) - 1, flags); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len2); tlen = strlen (temp); if (tlen > 0) _asn1_set_value (p, temp, tlen); counter += len2; move = RIGHT; break; case ASN1_ETYPE_OCTET_STRING: if (counter < inner_tag_len) { result = ASN1_DER_ERROR; warn(); goto cleanup; } result = get_octet_string (p, der + counter, ider_len, der + counter - inner_tag_len, inner_tag_len, &len3, flags); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len3); counter += len3; move = RIGHT; break; case ASN1_ETYPE_GENERALSTRING: case ASN1_ETYPE_NUMERIC_STRING: case ASN1_ETYPE_IA5_STRING: case ASN1_ETYPE_TELETEX_STRING: case ASN1_ETYPE_PRINTABLE_STRING: case ASN1_ETYPE_UNIVERSAL_STRING: case ASN1_ETYPE_BMP_STRING: case ASN1_ETYPE_UTF8_STRING: case ASN1_ETYPE_VISIBLE_STRING: case ASN1_ETYPE_BIT_STRING: len2 = asn1_get_length_der (der + counter, ider_len, &len3); if (len2 < 0) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len3+len2); _asn1_set_value (p, der + counter, len3 + len2); counter += len3 + len2; move = RIGHT; break; case ASN1_ETYPE_SEQUENCE: case ASN1_ETYPE_SET: if (move == UP) { len2 = p->tmp_ival; p->tmp_ival = 0; if (len2 == -1) { /* indefinite length method */ DECR_LEN(ider_len, 2); if ((der[counter]) || der[counter + 1]) { result = ASN1_DER_ERROR; warn(); goto cleanup; } counter += 2; } else { /* definite length method */ if (len2 != counter) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } move = RIGHT; } else { /* move==DOWN || move==RIGHT */ len3 = asn1_get_length_der (der + counter, ider_len, &len2); if (IS_ERR(len3, flags)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len2); counter += len2; if (len3 > 0) { p->tmp_ival = counter + len3; move = DOWN; } else if (len3 == 0) { p2 = p->down; while (p2) { if (type_field (p2->type) != ASN1_ETYPE_TAG) { p3 = p2->right; asn1_delete_structure (&p2); p2 = p3; } else p2 = p2->right; } move = RIGHT; } else { /* indefinite length method */ p->tmp_ival = -1; move = DOWN; } } break; case ASN1_ETYPE_SEQUENCE_OF: case ASN1_ETYPE_SET_OF: if (move == UP) { len2 = p->tmp_ival; if (len2 == -1) { /* indefinite length method */ if (!HAVE_TWO(ider_len) || ((der[counter]) || der[counter + 1])) { _asn1_append_sequence_set (p, &tcache); p = tcache.tail; move = RIGHT; continue; } p->tmp_ival = 0; tcache.tail = NULL; /* finished decoding this structure */ tcache.head = NULL; DECR_LEN(ider_len, 2); counter += 2; } else { /* definite length method */ if (len2 > counter) { _asn1_append_sequence_set (p, &tcache); p = tcache.tail; move = RIGHT; continue; } p->tmp_ival = 0; tcache.tail = NULL; /* finished decoding this structure */ tcache.head = NULL; if (len2 != counter) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } } else { /* move==DOWN || move==RIGHT */ len3 = asn1_get_length_der (der + counter, ider_len, &len2); if (IS_ERR(len3, flags)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len2); counter += len2; if (len3) { if (len3 > 0) { /* definite length method */ p->tmp_ival = counter + len3; } else { /* indefinite length method */ p->tmp_ival = -1; } p2 = p->down; while ((type_field (p2->type) == ASN1_ETYPE_TAG) || (type_field (p2->type) == ASN1_ETYPE_SIZE)) p2 = p2->right; if (p2->right == NULL) _asn1_append_sequence_set (p, &tcache); p = p2; } } move = RIGHT; break; case ASN1_ETYPE_ANY: /* Check indefinite lenth method in an EXPLICIT TAG */ if (!(flags & ASN1_DECODE_FLAG_STRICT_DER) && (p->type & CONST_TAG) && tag_len == 2 && (der[counter - 1] == 0x80)) indefinite = 1; else indefinite = 0; if (asn1_get_tag_der (der + counter, ider_len, &class, &len2, &tag) != ASN1_SUCCESS) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len2); len4 = asn1_get_length_der (der + counter + len2, ider_len, &len3); if (IS_ERR(len4, flags)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } if (len4 != -1) /* definite */ { len2 += len4; DECR_LEN(ider_len, len4+len3); _asn1_set_value_lv (p, der + counter, len2 + len3); counter += len2 + len3; } else /* == -1 */ { /* indefinite length */ ider_len += len2; /* undo DECR_LEN */ if (counter == 0) { result = ASN1_DER_ERROR; warn(); goto cleanup; } result = _asn1_get_indefinite_length_string (der + counter, ider_len, &len2); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len2); _asn1_set_value_lv (p, der + counter, len2); counter += len2; } /* Check if a couple of 0x00 are present due to an EXPLICIT TAG with an indefinite length method. */ if (indefinite) { DECR_LEN(ider_len, 2); if (!der[counter] && !der[counter + 1]) { counter += 2; } else { result = ASN1_DER_ERROR; warn(); goto cleanup; } } move = RIGHT; break; default: move = (move == UP) ? RIGHT : DOWN; break; } } if (p) { p->end = counter - 1; } if (p == node && move != DOWN) break; if (move == DOWN) { if (p->down) p = p->down; else move = RIGHT; } if ((move == RIGHT) && !(p->type & CONST_SET)) { if (p->right) p = p->right; else move = UP; } if (move == UP) p = _asn1_find_up (p); } _asn1_delete_not_used (*element); if ((ider_len < 0) || (!(flags & ASN1_DECODE_FLAG_ALLOW_PADDING) && (ider_len != 0))) { warn(); result = ASN1_DER_ERROR; goto cleanup; } *max_ider_len = total_len - ider_len; return ASN1_SUCCESS; cleanup: asn1_delete_structure (element); return result; }
DoS
0
asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, unsigned int flags, char *errorDescription) { asn1_node node, p, p2, p3; char temp[128]; int counter, len2, len3, len4, move, ris, tlen; struct node_tail_cache_st tcache = {NULL, NULL}; unsigned char class; unsigned long tag; int tag_len; int indefinite, result, total_len = *max_ider_len, ider_len = *max_ider_len; int inner_tag_len; const unsigned char *der = ider; node = *element; if (errorDescription != NULL) errorDescription[0] = 0; if (node == NULL) return ASN1_ELEMENT_NOT_FOUND; if (node->type & CONST_OPTION) { result = ASN1_GENERIC_ERROR; warn(); goto cleanup; } counter = 0; move = DOWN; p = node; while (1) { tag_len = 0; inner_tag_len = 0; ris = ASN1_SUCCESS; if (move != UP) { if (p->type & CONST_SET) { p2 = _asn1_find_up (p); len2 = p2->tmp_ival; if (len2 == -1) { if (HAVE_TWO(ider_len) && !der[counter] && !der[counter + 1]) { p = p2; move = UP; counter += 2; DECR_LEN(ider_len, 2); continue; } } else if (counter == len2) { p = p2; move = UP; continue; } else if (counter > len2) { result = ASN1_DER_ERROR; warn(); goto cleanup; } p2 = p2->down; while (p2) { if ((p2->type & CONST_SET) && (p2->type & CONST_NOT_USED)) { ris = extract_tag_der_recursive (p2, der + counter, ider_len, &len2, NULL, flags); if (ris == ASN1_SUCCESS) { p2->type &= ~CONST_NOT_USED; p = p2; break; } } p2 = p2->right; } if (p2 == NULL) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } /* the position in the DER structure this starts */ p->start = counter; p->end = total_len - 1; if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT)) { p2 = _asn1_find_up (p); len2 = p2->tmp_ival; if (counter == len2) { if (p->right) { p2 = p->right; move = RIGHT; } else move = UP; if (p->type & CONST_OPTION) asn1_delete_structure (&p); p = p2; continue; } } if (type_field (p->type) == ASN1_ETYPE_CHOICE) { while (p->down) { ris = extract_tag_der_recursive (p->down, der + counter, ider_len, &len2, NULL, flags); if (ris == ASN1_SUCCESS) { delete_unneeded_choice_fields(p->down); break; } else if (ris == ASN1_ERROR_TYPE_ANY) { result = ASN1_ERROR_TYPE_ANY; warn(); goto cleanup; } else { p2 = p->down; asn1_delete_structure (&p2); } } if (p->down == NULL) { if (!(p->type & CONST_OPTION)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } else if (type_field (p->type) != ASN1_ETYPE_CHOICE) p = p->down; p->start = counter; } if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT)) { p2 = _asn1_find_up (p); len2 = p2->tmp_ival; if ((len2 != -1) && (counter > len2)) ris = ASN1_TAG_ERROR; } if (ris == ASN1_SUCCESS) ris = extract_tag_der_recursive (p, der + counter, ider_len, &tag_len, &inner_tag_len, flags); if (ris != ASN1_SUCCESS) { if (p->type & CONST_OPTION) { p->type |= CONST_NOT_USED; move = RIGHT; } else if (p->type & CONST_DEFAULT) { _asn1_set_value (p, NULL, 0); move = RIGHT; } else { if (errorDescription != NULL) _asn1_error_description_tag_error (p, errorDescription); result = ASN1_TAG_ERROR; warn(); goto cleanup; } } else { DECR_LEN(ider_len, tag_len); counter += tag_len; } } if (ris == ASN1_SUCCESS) { switch (type_field (p->type)) { case ASN1_ETYPE_NULL: DECR_LEN(ider_len, 1); if (der[counter]) { result = ASN1_DER_ERROR; warn(); goto cleanup; } counter++; move = RIGHT; break; case ASN1_ETYPE_BOOLEAN: DECR_LEN(ider_len, 2); if (der[counter++] != 1) { result = ASN1_DER_ERROR; warn(); goto cleanup; } if (der[counter++] == 0) _asn1_set_value (p, "F", 1); else _asn1_set_value (p, "T", 1); move = RIGHT; break; case ASN1_ETYPE_INTEGER: case ASN1_ETYPE_ENUMERATED: len2 = asn1_get_length_der (der + counter, ider_len, &len3); if (len2 < 0) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len3+len2); _asn1_set_value (p, der + counter, len3 + len2); counter += len3 + len2; move = RIGHT; break; case ASN1_ETYPE_OBJECT_ID: result = asn1_get_object_id_der (der + counter, ider_len, &len2, temp, sizeof (temp)); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len2); tlen = strlen (temp); if (tlen > 0) _asn1_set_value (p, temp, tlen + 1); counter += len2; move = RIGHT; break; case ASN1_ETYPE_GENERALIZED_TIME: case ASN1_ETYPE_UTC_TIME: result = _asn1_get_time_der (type_field (p->type), der + counter, ider_len, &len2, temp, sizeof (temp) - 1, flags); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len2); tlen = strlen (temp); if (tlen > 0) _asn1_set_value (p, temp, tlen); counter += len2; move = RIGHT; break; case ASN1_ETYPE_OCTET_STRING: if (counter < inner_tag_len) { result = ASN1_DER_ERROR; warn(); goto cleanup; } result = get_octet_string (p, der + counter, ider_len, der + counter - inner_tag_len, inner_tag_len, &len3, flags); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len3); counter += len3; move = RIGHT; break; case ASN1_ETYPE_GENERALSTRING: case ASN1_ETYPE_NUMERIC_STRING: case ASN1_ETYPE_IA5_STRING: case ASN1_ETYPE_TELETEX_STRING: case ASN1_ETYPE_PRINTABLE_STRING: case ASN1_ETYPE_UNIVERSAL_STRING: case ASN1_ETYPE_BMP_STRING: case ASN1_ETYPE_UTF8_STRING: case ASN1_ETYPE_VISIBLE_STRING: case ASN1_ETYPE_BIT_STRING: len2 = asn1_get_length_der (der + counter, ider_len, &len3); if (len2 < 0) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len3+len2); _asn1_set_value (p, der + counter, len3 + len2); counter += len3 + len2; move = RIGHT; break; case ASN1_ETYPE_SEQUENCE: case ASN1_ETYPE_SET: if (move == UP) { len2 = p->tmp_ival; p->tmp_ival = 0; if (len2 == -1) { /* indefinite length method */ DECR_LEN(ider_len, 2); if ((der[counter]) || der[counter + 1]) { result = ASN1_DER_ERROR; warn(); goto cleanup; } counter += 2; } else { /* definite length method */ if (len2 != counter) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } move = RIGHT; } else { /* move==DOWN || move==RIGHT */ len3 = asn1_get_length_der (der + counter, ider_len, &len2); if (IS_ERR(len3, flags)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len2); counter += len2; if (len3 > 0) { p->tmp_ival = counter + len3; move = DOWN; } else if (len3 == 0) { p2 = p->down; while (p2) { if (type_field (p2->type) != ASN1_ETYPE_TAG) { p3 = p2->right; asn1_delete_structure (&p2); p2 = p3; } else p2 = p2->right; } move = RIGHT; } else { /* indefinite length method */ p->tmp_ival = -1; move = DOWN; } } break; case ASN1_ETYPE_SEQUENCE_OF: case ASN1_ETYPE_SET_OF: if (move == UP) { len2 = p->tmp_ival; if (len2 == -1) { /* indefinite length method */ if (!HAVE_TWO(ider_len) || ((der[counter]) || der[counter + 1])) { _asn1_append_sequence_set (p, &tcache); p = tcache.tail; move = RIGHT; continue; } p->tmp_ival = 0; tcache.tail = NULL; /* finished decoding this structure */ tcache.head = NULL; DECR_LEN(ider_len, 2); counter += 2; } else { /* definite length method */ if (len2 > counter) { _asn1_append_sequence_set (p, &tcache); p = tcache.tail; move = RIGHT; continue; } p->tmp_ival = 0; tcache.tail = NULL; /* finished decoding this structure */ tcache.head = NULL; if (len2 != counter) { result = ASN1_DER_ERROR; warn(); goto cleanup; } } } else { /* move==DOWN || move==RIGHT */ len3 = asn1_get_length_der (der + counter, ider_len, &len2); if (IS_ERR(len3, flags)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len2); counter += len2; if (len3) { if (len3 > 0) { /* definite length method */ p->tmp_ival = counter + len3; } else { /* indefinite length method */ p->tmp_ival = -1; } p2 = p->down; while ((type_field (p2->type) == ASN1_ETYPE_TAG) || (type_field (p2->type) == ASN1_ETYPE_SIZE)) p2 = p2->right; if (p2->right == NULL) _asn1_append_sequence_set (p, &tcache); p = p2; } } move = RIGHT; break; case ASN1_ETYPE_ANY: /* Check indefinite lenth method in an EXPLICIT TAG */ if (!(flags & ASN1_DECODE_FLAG_STRICT_DER) && (p->type & CONST_TAG) && tag_len == 2 && (der[counter - 1] == 0x80)) indefinite = 1; else indefinite = 0; if (asn1_get_tag_der (der + counter, ider_len, &class, &len2, &tag) != ASN1_SUCCESS) { result = ASN1_DER_ERROR; warn(); goto cleanup; } DECR_LEN(ider_len, len2); len4 = asn1_get_length_der (der + counter + len2, ider_len, &len3); if (IS_ERR(len4, flags)) { result = ASN1_DER_ERROR; warn(); goto cleanup; } if (len4 != -1) /* definite */ { len2 += len4; DECR_LEN(ider_len, len4+len3); _asn1_set_value_lv (p, der + counter, len2 + len3); counter += len2 + len3; } else /* == -1 */ { /* indefinite length */ ider_len += len2; /* undo DECR_LEN */ if (counter == 0) { result = ASN1_DER_ERROR; warn(); goto cleanup; } result = _asn1_get_indefinite_length_string (der + counter, ider_len, &len2); if (result != ASN1_SUCCESS) { warn(); goto cleanup; } DECR_LEN(ider_len, len2); _asn1_set_value_lv (p, der + counter, len2); counter += len2; } /* Check if a couple of 0x00 are present due to an EXPLICIT TAG with an indefinite length method. */ if (indefinite) { DECR_LEN(ider_len, 2); if (!der[counter] && !der[counter + 1]) { counter += 2; } else { result = ASN1_DER_ERROR; warn(); goto cleanup; } } move = RIGHT; break; default: move = (move == UP) ? RIGHT : DOWN; break; } } if (p) { p->end = counter - 1; } if (p == node && move != DOWN) break; if (move == DOWN) { if (p->down) p = p->down; else move = RIGHT; } if ((move == RIGHT) && !(p->type & CONST_SET)) { if (p->right) p = p->right; else move = UP; } if (move == UP) p = _asn1_find_up (p); } _asn1_delete_not_used (*element); if ((ider_len < 0) || (!(flags & ASN1_DECODE_FLAG_ALLOW_PADDING) && (ider_len != 0))) { warn(); result = ASN1_DER_ERROR; goto cleanup; } *max_ider_len = total_len - ider_len; return ASN1_SUCCESS; cleanup: asn1_delete_structure (element); return result; }
@@ -767,10 +767,17 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, DECR_LEN(der_len, len3); if (len2 == -1) - counter_end = der_len - 2; + { + if (der_len < 2) + return ASN1_DER_ERROR; + counter_end = der_len - 2; + } else counter_end = der_len; + if (counter_end < counter) + return ASN1_DER_ERROR; + while (counter < counter_end) { DECR_LEN(der_len, 1);
CWE-399
null
null
9,001
asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element) { char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; int retCode = ASN1_SUCCESS, result; int len, len2, len3; asn1_node p, p2, p3, aux = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; const char *definitionsName; if ((definitions == NULL) || (*element == NULL)) return ASN1_ELEMENT_NOT_FOUND; definitionsName = definitions->name; p = *element; while (p) { switch (type_field (p->type)) { case ASN1_ETYPE_ANY: if ((p->type & CONST_DEFINED_BY) && (p->value)) { /* search the "DEF_BY" element */ p2 = p->down; while ((p2) && (type_field (p2->type) != ASN1_ETYPE_CONSTANT)) p2 = p2->right; if (!p2) { retCode = ASN1_ERROR_TYPE_ANY; break; } p3 = _asn1_find_up (p); if (!p3) { retCode = ASN1_ERROR_TYPE_ANY; break; } p3 = p3->down; while (p3) { if (!(strcmp (p3->name, p2->name))) break; p3 = p3->right; } if ((!p3) || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) || (p3->value == NULL)) { p3 = _asn1_find_up (p); p3 = _asn1_find_up (p3); if (!p3) { retCode = ASN1_ERROR_TYPE_ANY; break; } p3 = p3->down; while (p3) { if (!(strcmp (p3->name, p2->name))) break; p3 = p3->right; } if ((!p3) || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) || (p3->value == NULL)) { retCode = ASN1_ERROR_TYPE_ANY; break; } } /* search the OBJECT_ID into definitions */ p2 = definitions->down; while (p2) { if ((type_field (p2->type) == ASN1_ETYPE_OBJECT_ID) && (p2->type & CONST_ASSIGN)) { snprintf(name, sizeof(name), "%s.%s", definitionsName, p2->name); len = ASN1_MAX_NAME_SIZE; result = asn1_read_value (definitions, name, value, &len); if ((result == ASN1_SUCCESS) && (!_asn1_strcmp (p3->value, value))) { p2 = p2->right; /* pointer to the structure to use for expansion */ while ((p2) && (p2->type & CONST_ASSIGN)) p2 = p2->right; if (p2) { snprintf(name, sizeof(name), "%s.%s", definitionsName, p2->name); result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) { _asn1_cpy_name (aux, p); len2 = asn1_get_length_der (p->value, p->value_len, &len3); if (len2 < 0) return ASN1_DER_ERROR; result = asn1_der_decoding (&aux, p->value + len3, len2, errorDescription); if (result == ASN1_SUCCESS) { _asn1_set_right (aux, p->right); _asn1_set_right (p, aux); result = asn1_delete_structure (&p); if (result == ASN1_SUCCESS) { p = aux; aux = NULL; break; } else { /* error with asn1_delete_structure */ asn1_delete_structure (&aux); retCode = result; break; } } else { /* error with asn1_der_decoding */ retCode = result; break; } } else { /* error with asn1_create_element */ retCode = result; break; } } else { /* error with the pointer to the structure to exapand */ retCode = ASN1_ERROR_TYPE_ANY; break; } } } p2 = p2->right; } /* end while */ if (!p2) { retCode = ASN1_ERROR_TYPE_ANY; break; } } break; default: break; } if (p->down) { p = p->down; } else if (p == *element) { p = NULL; break; } else if (p->right) p = p->right; else { while (1) { p = _asn1_find_up (p); if (p == *element) { p = NULL; break; } if (p->right) { p = p->right; break; } } } } return retCode; }
DoS
0
asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element) { char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; int retCode = ASN1_SUCCESS, result; int len, len2, len3; asn1_node p, p2, p3, aux = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; const char *definitionsName; if ((definitions == NULL) || (*element == NULL)) return ASN1_ELEMENT_NOT_FOUND; definitionsName = definitions->name; p = *element; while (p) { switch (type_field (p->type)) { case ASN1_ETYPE_ANY: if ((p->type & CONST_DEFINED_BY) && (p->value)) { /* search the "DEF_BY" element */ p2 = p->down; while ((p2) && (type_field (p2->type) != ASN1_ETYPE_CONSTANT)) p2 = p2->right; if (!p2) { retCode = ASN1_ERROR_TYPE_ANY; break; } p3 = _asn1_find_up (p); if (!p3) { retCode = ASN1_ERROR_TYPE_ANY; break; } p3 = p3->down; while (p3) { if (!(strcmp (p3->name, p2->name))) break; p3 = p3->right; } if ((!p3) || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) || (p3->value == NULL)) { p3 = _asn1_find_up (p); p3 = _asn1_find_up (p3); if (!p3) { retCode = ASN1_ERROR_TYPE_ANY; break; } p3 = p3->down; while (p3) { if (!(strcmp (p3->name, p2->name))) break; p3 = p3->right; } if ((!p3) || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) || (p3->value == NULL)) { retCode = ASN1_ERROR_TYPE_ANY; break; } } /* search the OBJECT_ID into definitions */ p2 = definitions->down; while (p2) { if ((type_field (p2->type) == ASN1_ETYPE_OBJECT_ID) && (p2->type & CONST_ASSIGN)) { snprintf(name, sizeof(name), "%s.%s", definitionsName, p2->name); len = ASN1_MAX_NAME_SIZE; result = asn1_read_value (definitions, name, value, &len); if ((result == ASN1_SUCCESS) && (!_asn1_strcmp (p3->value, value))) { p2 = p2->right; /* pointer to the structure to use for expansion */ while ((p2) && (p2->type & CONST_ASSIGN)) p2 = p2->right; if (p2) { snprintf(name, sizeof(name), "%s.%s", definitionsName, p2->name); result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) { _asn1_cpy_name (aux, p); len2 = asn1_get_length_der (p->value, p->value_len, &len3); if (len2 < 0) return ASN1_DER_ERROR; result = asn1_der_decoding (&aux, p->value + len3, len2, errorDescription); if (result == ASN1_SUCCESS) { _asn1_set_right (aux, p->right); _asn1_set_right (p, aux); result = asn1_delete_structure (&p); if (result == ASN1_SUCCESS) { p = aux; aux = NULL; break; } else { /* error with asn1_delete_structure */ asn1_delete_structure (&aux); retCode = result; break; } } else { /* error with asn1_der_decoding */ retCode = result; break; } } else { /* error with asn1_create_element */ retCode = result; break; } } else { /* error with the pointer to the structure to exapand */ retCode = ASN1_ERROR_TYPE_ANY; break; } } } p2 = p2->right; } /* end while */ if (!p2) { retCode = ASN1_ERROR_TYPE_ANY; break; } } break; default: break; } if (p->down) { p = p->down; } else if (p == *element) { p = NULL; break; } else if (p->right) p = p->right; else { while (1) { p = _asn1_find_up (p); if (p == *element) { p = NULL; break; } if (p->right) { p = p->right; break; } } } } return retCode; }
@@ -767,10 +767,17 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, DECR_LEN(der_len, len3); if (len2 == -1) - counter_end = der_len - 2; + { + if (der_len < 2) + return ASN1_DER_ERROR; + counter_end = der_len - 2; + } else counter_end = der_len; + if (counter_end < counter) + return ASN1_DER_ERROR; + while (counter < counter_end) { DECR_LEN(der_len, 1);
CWE-399
null
null
9,002
asn1_expand_octet_string (asn1_node definitions, asn1_node * element, const char *octetName, const char *objectName) { char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; int retCode = ASN1_SUCCESS, result; int len, len2, len3; asn1_node p2, aux = NULL; asn1_node octetNode = NULL, objectNode = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; if ((definitions == NULL) || (*element == NULL)) return ASN1_ELEMENT_NOT_FOUND; octetNode = asn1_find_node (*element, octetName); if (octetNode == NULL) return ASN1_ELEMENT_NOT_FOUND; if (type_field (octetNode->type) != ASN1_ETYPE_OCTET_STRING) return ASN1_ELEMENT_NOT_FOUND; if (octetNode->value == NULL) return ASN1_VALUE_NOT_FOUND; objectNode = asn1_find_node (*element, objectName); if (objectNode == NULL) return ASN1_ELEMENT_NOT_FOUND; if (type_field (objectNode->type) != ASN1_ETYPE_OBJECT_ID) return ASN1_ELEMENT_NOT_FOUND; if (objectNode->value == NULL) return ASN1_VALUE_NOT_FOUND; /* search the OBJECT_ID into definitions */ p2 = definitions->down; while (p2) { if ((type_field (p2->type) == ASN1_ETYPE_OBJECT_ID) && (p2->type & CONST_ASSIGN)) { strcpy (name, definitions->name); strcat (name, "."); strcat (name, p2->name); len = sizeof (value); result = asn1_read_value (definitions, name, value, &len); if ((result == ASN1_SUCCESS) && (!_asn1_strcmp (objectNode->value, value))) { p2 = p2->right; /* pointer to the structure to use for expansion */ while ((p2) && (p2->type & CONST_ASSIGN)) p2 = p2->right; if (p2) { strcpy (name, definitions->name); strcat (name, "."); strcat (name, p2->name); result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) { _asn1_cpy_name (aux, octetNode); len2 = asn1_get_length_der (octetNode->value, octetNode->value_len, &len3); if (len2 < 0) return ASN1_DER_ERROR; result = asn1_der_decoding (&aux, octetNode->value + len3, len2, errorDescription); if (result == ASN1_SUCCESS) { _asn1_set_right (aux, octetNode->right); _asn1_set_right (octetNode, aux); result = asn1_delete_structure (&octetNode); if (result == ASN1_SUCCESS) { aux = NULL; break; } else { /* error with asn1_delete_structure */ asn1_delete_structure (&aux); retCode = result; break; } } else { /* error with asn1_der_decoding */ retCode = result; break; } } else { /* error with asn1_create_element */ retCode = result; break; } } else { /* error with the pointer to the structure to exapand */ retCode = ASN1_VALUE_NOT_VALID; break; } } } p2 = p2->right; } if (!p2) retCode = ASN1_VALUE_NOT_VALID; return retCode; }
DoS
0
asn1_expand_octet_string (asn1_node definitions, asn1_node * element, const char *octetName, const char *objectName) { char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; int retCode = ASN1_SUCCESS, result; int len, len2, len3; asn1_node p2, aux = NULL; asn1_node octetNode = NULL, objectNode = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; if ((definitions == NULL) || (*element == NULL)) return ASN1_ELEMENT_NOT_FOUND; octetNode = asn1_find_node (*element, octetName); if (octetNode == NULL) return ASN1_ELEMENT_NOT_FOUND; if (type_field (octetNode->type) != ASN1_ETYPE_OCTET_STRING) return ASN1_ELEMENT_NOT_FOUND; if (octetNode->value == NULL) return ASN1_VALUE_NOT_FOUND; objectNode = asn1_find_node (*element, objectName); if (objectNode == NULL) return ASN1_ELEMENT_NOT_FOUND; if (type_field (objectNode->type) != ASN1_ETYPE_OBJECT_ID) return ASN1_ELEMENT_NOT_FOUND; if (objectNode->value == NULL) return ASN1_VALUE_NOT_FOUND; /* search the OBJECT_ID into definitions */ p2 = definitions->down; while (p2) { if ((type_field (p2->type) == ASN1_ETYPE_OBJECT_ID) && (p2->type & CONST_ASSIGN)) { strcpy (name, definitions->name); strcat (name, "."); strcat (name, p2->name); len = sizeof (value); result = asn1_read_value (definitions, name, value, &len); if ((result == ASN1_SUCCESS) && (!_asn1_strcmp (objectNode->value, value))) { p2 = p2->right; /* pointer to the structure to use for expansion */ while ((p2) && (p2->type & CONST_ASSIGN)) p2 = p2->right; if (p2) { strcpy (name, definitions->name); strcat (name, "."); strcat (name, p2->name); result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) { _asn1_cpy_name (aux, octetNode); len2 = asn1_get_length_der (octetNode->value, octetNode->value_len, &len3); if (len2 < 0) return ASN1_DER_ERROR; result = asn1_der_decoding (&aux, octetNode->value + len3, len2, errorDescription); if (result == ASN1_SUCCESS) { _asn1_set_right (aux, octetNode->right); _asn1_set_right (octetNode, aux); result = asn1_delete_structure (&octetNode); if (result == ASN1_SUCCESS) { aux = NULL; break; } else { /* error with asn1_delete_structure */ asn1_delete_structure (&aux); retCode = result; break; } } else { /* error with asn1_der_decoding */ retCode = result; break; } } else { /* error with asn1_create_element */ retCode = result; break; } } else { /* error with the pointer to the structure to exapand */ retCode = ASN1_VALUE_NOT_VALID; break; } } } p2 = p2->right; } if (!p2) retCode = ASN1_VALUE_NOT_VALID; return retCode; }
@@ -767,10 +767,17 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, DECR_LEN(der_len, len3); if (len2 == -1) - counter_end = der_len - 2; + { + if (der_len < 2) + return ASN1_DER_ERROR; + counter_end = der_len - 2; + } else counter_end = der_len; + if (counter_end < counter) + return ASN1_DER_ERROR; + while (counter < counter_end) { DECR_LEN(der_len, 1);
CWE-399
null
null
9,003
asn1_get_bit_der (const unsigned char *der, int der_len, int *ret_len, unsigned char *str, int str_size, int *bit_len) { int len_len = 0, len_byte; if (der_len <= 0) return ASN1_GENERIC_ERROR; len_byte = asn1_get_length_der (der, der_len, &len_len) - 1; if (len_byte < 0) return ASN1_DER_ERROR; *ret_len = len_byte + len_len + 1; *bit_len = len_byte * 8 - der[len_len]; if (*bit_len < 0) return ASN1_DER_ERROR; if (str_size >= len_byte) { if (len_byte > 0 && str) memcpy (str, der + len_len + 1, len_byte); } else { return ASN1_MEM_ERROR; } return ASN1_SUCCESS; }
DoS
0
asn1_get_bit_der (const unsigned char *der, int der_len, int *ret_len, unsigned char *str, int str_size, int *bit_len) { int len_len = 0, len_byte; if (der_len <= 0) return ASN1_GENERIC_ERROR; len_byte = asn1_get_length_der (der, der_len, &len_len) - 1; if (len_byte < 0) return ASN1_DER_ERROR; *ret_len = len_byte + len_len + 1; *bit_len = len_byte * 8 - der[len_len]; if (*bit_len < 0) return ASN1_DER_ERROR; if (str_size >= len_byte) { if (len_byte > 0 && str) memcpy (str, der + len_len + 1, len_byte); } else { return ASN1_MEM_ERROR; } return ASN1_SUCCESS; }
@@ -767,10 +767,17 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, DECR_LEN(der_len, len3); if (len2 == -1) - counter_end = der_len - 2; + { + if (der_len < 2) + return ASN1_DER_ERROR; + counter_end = der_len - 2; + } else counter_end = der_len; + if (counter_end < counter) + return ASN1_DER_ERROR; + while (counter < counter_end) { DECR_LEN(der_len, 1);
CWE-399
null
null
9,004
asn1_get_length_der (const unsigned char *der, int der_len, int *len) { unsigned int ans; int k, punt, sum; *len = 0; if (der_len <= 0) return 0; if (!(der[0] & 128)) { /* short form */ *len = 1; ans = der[0]; } else { /* Long form */ k = der[0] & 0x7F; punt = 1; if (k) { /* definite length method */ ans = 0; while (punt <= k && punt < der_len) { if (INT_MULTIPLY_OVERFLOW (ans, 256)) return -2; ans *= 256; if (INT_ADD_OVERFLOW (ans, ((unsigned) der[punt]))) return -2; ans += der[punt]; punt++; } } else { /* indefinite length method */ *len = punt; return -1; } *len = punt; } sum = ans; if (ans >= INT_MAX || INT_ADD_OVERFLOW (sum, (*len))) return -2; sum += *len; if (sum > der_len) return -4; return ans; }
DoS
0
asn1_get_length_der (const unsigned char *der, int der_len, int *len) { unsigned int ans; int k, punt, sum; *len = 0; if (der_len <= 0) return 0; if (!(der[0] & 128)) { /* short form */ *len = 1; ans = der[0]; } else { /* Long form */ k = der[0] & 0x7F; punt = 1; if (k) { /* definite length method */ ans = 0; while (punt <= k && punt < der_len) { if (INT_MULTIPLY_OVERFLOW (ans, 256)) return -2; ans *= 256; if (INT_ADD_OVERFLOW (ans, ((unsigned) der[punt]))) return -2; ans += der[punt]; punt++; } } else { /* indefinite length method */ *len = punt; return -1; } *len = punt; } sum = ans; if (ans >= INT_MAX || INT_ADD_OVERFLOW (sum, (*len))) return -2; sum += *len; if (sum > der_len) return -4; return ans; }
@@ -767,10 +767,17 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, DECR_LEN(der_len, len3); if (len2 == -1) - counter_end = der_len - 2; + { + if (der_len < 2) + return ASN1_DER_ERROR; + counter_end = der_len - 2; + } else counter_end = der_len; + if (counter_end < counter) + return ASN1_DER_ERROR; + while (counter < counter_end) { DECR_LEN(der_len, 1);
CWE-399
null
null
9,005
asn1_get_object_id_der (const unsigned char *der, int der_len, int *ret_len, char *str, int str_size) { int len_len, len, k; int leading; char temp[LTOSTR_MAX_SIZE]; unsigned long val, val1; *ret_len = 0; if (str && str_size > 0) str[0] = 0; /* no oid */ if (str == NULL || der_len <= 0) return ASN1_GENERIC_ERROR; len = asn1_get_length_der (der, der_len, &len_len); if (len <= 0 || len + len_len > der_len) return ASN1_DER_ERROR; val1 = der[len_len] / 40; val = der[len_len] - val1 * 40; _asn1_str_cpy (str, str_size, _asn1_ltostr (val1, temp)); _asn1_str_cat (str, str_size, "."); _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp)); val = 0; leading = 1; for (k = 1; k < len; k++) { /* X.690 mandates that the leading byte must never be 0x80 */ if (leading != 0 && der[len_len + k] == 0x80) return ASN1_DER_ERROR; leading = 0; /* check for wrap around */ if (INT_LEFT_SHIFT_OVERFLOW (val, 7)) return ASN1_DER_ERROR; val = val << 7; val |= der[len_len + k] & 0x7F; if (!(der[len_len + k] & 0x80)) { _asn1_str_cat (str, str_size, "."); _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp)); val = 0; leading = 1; } } if (INT_ADD_OVERFLOW (len, len_len)) return ASN1_DER_ERROR; *ret_len = len + len_len; return ASN1_SUCCESS; }
DoS
0
asn1_get_object_id_der (const unsigned char *der, int der_len, int *ret_len, char *str, int str_size) { int len_len, len, k; int leading; char temp[LTOSTR_MAX_SIZE]; unsigned long val, val1; *ret_len = 0; if (str && str_size > 0) str[0] = 0; /* no oid */ if (str == NULL || der_len <= 0) return ASN1_GENERIC_ERROR; len = asn1_get_length_der (der, der_len, &len_len); if (len <= 0 || len + len_len > der_len) return ASN1_DER_ERROR; val1 = der[len_len] / 40; val = der[len_len] - val1 * 40; _asn1_str_cpy (str, str_size, _asn1_ltostr (val1, temp)); _asn1_str_cat (str, str_size, "."); _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp)); val = 0; leading = 1; for (k = 1; k < len; k++) { /* X.690 mandates that the leading byte must never be 0x80 */ if (leading != 0 && der[len_len + k] == 0x80) return ASN1_DER_ERROR; leading = 0; /* check for wrap around */ if (INT_LEFT_SHIFT_OVERFLOW (val, 7)) return ASN1_DER_ERROR; val = val << 7; val |= der[len_len + k] & 0x7F; if (!(der[len_len + k] & 0x80)) { _asn1_str_cat (str, str_size, "."); _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp)); val = 0; leading = 1; } } if (INT_ADD_OVERFLOW (len, len_len)) return ASN1_DER_ERROR; *ret_len = len + len_len; return ASN1_SUCCESS; }
@@ -767,10 +767,17 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, DECR_LEN(der_len, len3); if (len2 == -1) - counter_end = der_len - 2; + { + if (der_len < 2) + return ASN1_DER_ERROR; + counter_end = der_len - 2; + } else counter_end = der_len; + if (counter_end < counter) + return ASN1_DER_ERROR; + while (counter < counter_end) { DECR_LEN(der_len, 1);
CWE-399
null
null
9,006
static void delete_unneeded_choice_fields(asn1_node p) { asn1_node p2; while (p->right) { p2 = p->right; asn1_delete_structure (&p2); } }
DoS
0
static void delete_unneeded_choice_fields(asn1_node p) { asn1_node p2; while (p->right) { p2 = p->right; asn1_delete_structure (&p2); } }
@@ -767,10 +767,17 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, DECR_LEN(der_len, len3); if (len2 == -1) - counter_end = der_len - 2; + { + if (der_len < 2) + return ASN1_DER_ERROR; + counter_end = der_len - 2; + } else counter_end = der_len; + if (counter_end < counter) + return ASN1_DER_ERROR; + while (counter < counter_end) { DECR_LEN(der_len, 1);
CWE-399
null
null
9,007
static void stellaris_enet_send(stellaris_enet_state *s) { int framelen = stellaris_txpacket_datalen(s); /* Ethernet header is in the FIFO but not in the datacount. * We don't implement explicit CRC, so just ignore any * CRC value in the FIFO. */ framelen += 14; if ((s->tctl & SE_TCTL_PADEN) && framelen < 60) { memset(&s->tx_fifo[framelen + 2], 0, 60 - framelen); framelen = 60; } /* This MIN will have no effect unless the FIFO data is corrupt * (eg bad data from an incoming migration); otherwise the check * on the datalen at the start of writing the data into the FIFO * will have caught this. Silently write a corrupt half-packet, * which is what the hardware does in FIFO underrun situations. */ framelen = MIN(framelen, ARRAY_SIZE(s->tx_fifo) - 2); qemu_send_packet(qemu_get_queue(s->nic), s->tx_fifo + 2, framelen); s->tx_fifo_len = 0; s->ris |= SE_INT_TXEMP; stellaris_enet_update(s); DPRINTF("Done TX\n"); }
DoS Overflow
0
static void stellaris_enet_send(stellaris_enet_state *s) { int framelen = stellaris_txpacket_datalen(s); /* Ethernet header is in the FIFO but not in the datacount. * We don't implement explicit CRC, so just ignore any * CRC value in the FIFO. */ framelen += 14; if ((s->tctl & SE_TCTL_PADEN) && framelen < 60) { memset(&s->tx_fifo[framelen + 2], 0, 60 - framelen); framelen = 60; } /* This MIN will have no effect unless the FIFO data is corrupt * (eg bad data from an incoming migration); otherwise the check * on the datalen at the start of writing the data into the FIFO * will have caught this. Silently write a corrupt half-packet, * which is what the hardware does in FIFO underrun situations. */ framelen = MIN(framelen, ARRAY_SIZE(s->tx_fifo) - 2); qemu_send_packet(qemu_get_queue(s->nic), s->tx_fifo + 2, framelen); s->tx_fifo_len = 0; s->ris |= SE_INT_TXEMP; stellaris_enet_update(s); DPRINTF("Done TX\n"); }
@@ -236,8 +236,18 @@ static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, si n = s->next_packet + s->np; if (n >= 31) n -= 31; - s->np++; + if (size >= sizeof(s->rx[n].data) - 6) { + /* If the packet won't fit into the + * emulated 2K RAM, this is reported + * as a FIFO overrun error. + */ + s->ris |= SE_INT_FOV; + stellaris_enet_update(s); + return -1; + } + + s->np++; s->rx[n].len = size + 6; p = s->rx[n].data; *(p++) = (size + 6);
CWE-20
null
null
9,008
static void stellaris_enet_update(stellaris_enet_state *s) { qemu_set_irq(s->irq, (s->ris & s->im) != 0); }
DoS Overflow
0
static void stellaris_enet_update(stellaris_enet_state *s) { qemu_set_irq(s->irq, (s->ris & s->im) != 0); }
@@ -236,8 +236,18 @@ static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, si n = s->next_packet + s->np; if (n >= 31) n -= 31; - s->np++; + if (size >= sizeof(s->rx[n].data) - 6) { + /* If the packet won't fit into the + * emulated 2K RAM, this is reported + * as a FIFO overrun error. + */ + s->ris |= SE_INT_FOV; + stellaris_enet_update(s); + return -1; + } + + s->np++; s->rx[n].len = size + 6; p = s->rx[n].data; *(p++) = (size + 6);
CWE-20
null
null
9,009
static inline bool stellaris_tx_thr_reached(stellaris_enet_state *s) { return (s->thr < 0x3f && (s->tx_fifo_len >= 4 * (s->thr * 8 + 1))); }
DoS Overflow
0
static inline bool stellaris_tx_thr_reached(stellaris_enet_state *s) { return (s->thr < 0x3f && (s->tx_fifo_len >= 4 * (s->thr * 8 + 1))); }
@@ -236,8 +236,18 @@ static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, si n = s->next_packet + s->np; if (n >= 31) n -= 31; - s->np++; + if (size >= sizeof(s->rx[n].data) - 6) { + /* If the packet won't fit into the + * emulated 2K RAM, this is reported + * as a FIFO overrun error. + */ + s->ris |= SE_INT_FOV; + stellaris_enet_update(s); + return -1; + } + + s->np++; s->rx[n].len = size + 6; p = s->rx[n].data; *(p++) = (size + 6);
CWE-20
null
null
9,010
static inline bool stellaris_txpacket_complete(stellaris_enet_state *s) { int framelen = stellaris_txpacket_datalen(s); framelen += 16; if (!(s->tctl & SE_TCTL_CRC)) { framelen += 4; } /* Cover the corner case of a 2032 byte payload with auto-CRC disabled: * this requires more bytes than will fit in the FIFO. It's not totally * clear how the h/w handles this, but if using threshold-based TX * it will definitely try to transmit something. */ framelen = MIN(framelen, ARRAY_SIZE(s->tx_fifo)); return s->tx_fifo_len >= framelen; }
DoS Overflow
0
static inline bool stellaris_txpacket_complete(stellaris_enet_state *s) { int framelen = stellaris_txpacket_datalen(s); framelen += 16; if (!(s->tctl & SE_TCTL_CRC)) { framelen += 4; } /* Cover the corner case of a 2032 byte payload with auto-CRC disabled: * this requires more bytes than will fit in the FIFO. It's not totally * clear how the h/w handles this, but if using threshold-based TX * it will definitely try to transmit something. */ framelen = MIN(framelen, ARRAY_SIZE(s->tx_fifo)); return s->tx_fifo_len >= framelen; }
@@ -236,8 +236,18 @@ static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, si n = s->next_packet + s->np; if (n >= 31) n -= 31; - s->np++; + if (size >= sizeof(s->rx[n].data) - 6) { + /* If the packet won't fit into the + * emulated 2K RAM, this is reported + * as a FIFO overrun error. + */ + s->ris |= SE_INT_FOV; + stellaris_enet_update(s); + return -1; + } + + s->np++; s->rx[n].len = size + 6; p = s->rx[n].data; *(p++) = (size + 6);
CWE-20
null
null
9,011
static inline int stellaris_txpacket_datalen(stellaris_enet_state *s) { return s->tx_fifo[0] | (s->tx_fifo[1] << 8); }
DoS Overflow
0
static inline int stellaris_txpacket_datalen(stellaris_enet_state *s) { return s->tx_fifo[0] | (s->tx_fifo[1] << 8); }
@@ -236,8 +236,18 @@ static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, si n = s->next_packet + s->np; if (n >= 31) n -= 31; - s->np++; + if (size >= sizeof(s->rx[n].data) - 6) { + /* If the packet won't fit into the + * emulated 2K RAM, this is reported + * as a FIFO overrun error. + */ + s->ris |= SE_INT_FOV; + stellaris_enet_update(s); + return -1; + } + + s->np++; s->rx[n].len = size + 6; p = s->rx[n].data; *(p++) = (size + 6);
CWE-20
null
null
9,012
__imlib_FreeUpdates(ImlibUpdate * u) { ImlibUpdate *uu; uu = u; while (uu) { u = uu; uu = uu->next; free(u); } }
DoS Overflow
0
__imlib_FreeUpdates(ImlibUpdate * u) { ImlibUpdate *uu; uu = u; while (uu) { u = uu; uu = uu->next; free(u); } }
@@ -112,7 +112,7 @@ __imlib_MergeUpdate(ImlibUpdate * u, int w, int h, int hgapmax) int xx, yy, ww, hh, ok, xww; for (xx = x + 1, ww = 1; - (T(xx, y).used & T_USED) && (xx < tw); xx++, ww++); + (xx < tw) && (T(xx, y).used & T_USED); xx++, ww++); xww = x + ww; for (yy = y + 1, hh = 1, ok = 1; (yy < th) && (ok); yy++, hh++)
CWE-119
null
null
9,013
_gnutls_decrypt (gnutls_session_t session, uint8_t * ciphertext, size_t ciphertext_size, uint8_t * data, size_t max_data_size, content_type_t type, record_parameters_st * params, uint64 *sequence) { gnutls_datum_t gcipher; int ret, data_size; if (ciphertext_size == 0) return 0; gcipher.size = ciphertext_size; gcipher.data = ciphertext; if (is_read_comp_null (params) == 0) { ret = ciphertext_to_compressed (session, &gcipher, data, max_data_size, type, params, sequence); if (ret < 0) return gnutls_assert_val(ret); return ret; } else { uint8_t* tmp_data; tmp_data = gnutls_malloc(max_data_size); if (tmp_data == NULL) return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); ret = ciphertext_to_compressed (session, &gcipher, tmp_data, max_data_size, type, params, sequence); if (ret < 0) goto leave; data_size = ret; if (ret != 0) { ret = _gnutls_decompress( &params->read.compression_state, tmp_data, data_size, data, max_data_size); if (ret < 0) goto leave; } leave: gnutls_free(tmp_data); return ret; } }
DoS Mem. Corr.
0
_gnutls_decrypt (gnutls_session_t session, uint8_t * ciphertext, size_t ciphertext_size, uint8_t * data, size_t max_data_size, content_type_t type, record_parameters_st * params, uint64 *sequence) { gnutls_datum_t gcipher; int ret, data_size; if (ciphertext_size == 0) return 0; gcipher.size = ciphertext_size; gcipher.data = ciphertext; if (is_read_comp_null (params) == 0) { ret = ciphertext_to_compressed (session, &gcipher, data, max_data_size, type, params, sequence); if (ret < 0) return gnutls_assert_val(ret); return ret; } else { uint8_t* tmp_data; tmp_data = gnutls_malloc(max_data_size); if (tmp_data == NULL) return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); ret = ciphertext_to_compressed (session, &gcipher, tmp_data, max_data_size, type, params, sequence); if (ret < 0) goto leave; data_size = ret; if (ret != 0) { ret = _gnutls_decompress( &params->read.compression_state, tmp_data, data_size, data, max_data_size); if (ret < 0) goto leave; } leave: gnutls_free(tmp_data); return ret; } }
@@ -354,7 +354,7 @@ compressed_to_ciphertext (gnutls_session_t session, ret = _gnutls_rnd (GNUTLS_RND_NONCE, data_ptr, blocksize); if (ret < 0) return gnutls_assert_val(ret); - + _gnutls_auth_cipher_setiv(&params->write.cipher_state, data_ptr, blocksize); data_ptr += blocksize; @@ -509,7 +509,7 @@ ciphertext_to_compressed (gnutls_session_t session, break; case CIPHER_BLOCK: - if (ciphertext->size < MAX(blocksize, tag_size) || (ciphertext->size % blocksize != 0)) + if (ciphertext->size < blocksize || (ciphertext->size % blocksize != 0)) return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH); /* ignore the IV in TLS 1.1+ @@ -521,14 +521,11 @@ ciphertext_to_compressed (gnutls_session_t session, ciphertext->size -= blocksize; ciphertext->data += blocksize; - - if (ciphertext->size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext->size < tag_size) + return gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED); + /* we don't use the auth_cipher interface here, since * TLS with block ciphers is impossible to be used under such * an API. (the length of plaintext is required to calculate @@ -541,6 +538,7 @@ ciphertext_to_compressed (gnutls_session_t session, pad = ciphertext->data[ciphertext->size - 1] + 1; /* pad */ + if ((int) pad > (int) ciphertext->size - tag_size) { gnutls_assert ();
CWE-310
null
null
9,014
_gnutls_encrypt (gnutls_session_t session, const uint8_t * headers, size_t headers_size, const uint8_t * data, size_t data_size, uint8_t * ciphertext, size_t ciphertext_size, content_type_t type, record_parameters_st * params) { gnutls_datum_t comp; int free_comp = 0; int ret; if (data_size == 0 || is_write_comp_null (params) == 0) { comp.data = (uint8_t*)data; comp.size = data_size; } else { /* Here comp is allocated and must be * freed. */ free_comp = 1; comp.size = ciphertext_size - headers_size; comp.data = gnutls_malloc(comp.size); if (comp.data == NULL) return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); ret = _gnutls_compress( &params->write.compression_state, data, data_size, comp.data, comp.size); if (ret < 0) { gnutls_free(comp.data); return gnutls_assert_val(ret); } comp.size = ret; } ret = compressed_to_ciphertext (session, &ciphertext[headers_size], ciphertext_size - headers_size, &comp, type, params); if (free_comp) gnutls_free(comp.data); if (ret < 0) return gnutls_assert_val(ret); /* copy the headers */ memcpy (ciphertext, headers, headers_size); if(IS_DTLS(session)) _gnutls_write_uint16 (ret, &ciphertext[11]); else _gnutls_write_uint16 (ret, &ciphertext[3]); return ret + headers_size; }
DoS Mem. Corr.
0
_gnutls_encrypt (gnutls_session_t session, const uint8_t * headers, size_t headers_size, const uint8_t * data, size_t data_size, uint8_t * ciphertext, size_t ciphertext_size, content_type_t type, record_parameters_st * params) { gnutls_datum_t comp; int free_comp = 0; int ret; if (data_size == 0 || is_write_comp_null (params) == 0) { comp.data = (uint8_t*)data; comp.size = data_size; } else { /* Here comp is allocated and must be * freed. */ free_comp = 1; comp.size = ciphertext_size - headers_size; comp.data = gnutls_malloc(comp.size); if (comp.data == NULL) return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); ret = _gnutls_compress( &params->write.compression_state, data, data_size, comp.data, comp.size); if (ret < 0) { gnutls_free(comp.data); return gnutls_assert_val(ret); } comp.size = ret; } ret = compressed_to_ciphertext (session, &ciphertext[headers_size], ciphertext_size - headers_size, &comp, type, params); if (free_comp) gnutls_free(comp.data); if (ret < 0) return gnutls_assert_val(ret); /* copy the headers */ memcpy (ciphertext, headers, headers_size); if(IS_DTLS(session)) _gnutls_write_uint16 (ret, &ciphertext[11]); else _gnutls_write_uint16 (ret, &ciphertext[3]); return ret + headers_size; }
@@ -354,7 +354,7 @@ compressed_to_ciphertext (gnutls_session_t session, ret = _gnutls_rnd (GNUTLS_RND_NONCE, data_ptr, blocksize); if (ret < 0) return gnutls_assert_val(ret); - + _gnutls_auth_cipher_setiv(&params->write.cipher_state, data_ptr, blocksize); data_ptr += blocksize; @@ -509,7 +509,7 @@ ciphertext_to_compressed (gnutls_session_t session, break; case CIPHER_BLOCK: - if (ciphertext->size < MAX(blocksize, tag_size) || (ciphertext->size % blocksize != 0)) + if (ciphertext->size < blocksize || (ciphertext->size % blocksize != 0)) return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH); /* ignore the IV in TLS 1.1+ @@ -521,14 +521,11 @@ ciphertext_to_compressed (gnutls_session_t session, ciphertext->size -= blocksize; ciphertext->data += blocksize; - - if (ciphertext->size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext->size < tag_size) + return gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED); + /* we don't use the auth_cipher interface here, since * TLS with block ciphers is impossible to be used under such * an API. (the length of plaintext is required to calculate @@ -541,6 +538,7 @@ ciphertext_to_compressed (gnutls_session_t session, pad = ciphertext->data[ciphertext->size - 1] + 1; /* pad */ + if ((int) pad > (int) ciphertext->size - tag_size) { gnutls_assert ();
CWE-310
null
null
9,015
calc_enc_length (gnutls_session_t session, int data_size, int hash_size, uint8_t * pad, int random_pad, unsigned block_algo, unsigned auth_cipher, uint16_t blocksize) { uint8_t rnd; unsigned int length; int ret; *pad = 0; switch (block_algo) { case CIPHER_STREAM: length = data_size + hash_size; if (auth_cipher) length += AEAD_EXPLICIT_DATA_SIZE; break; case CIPHER_BLOCK: ret = _gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1); if (ret < 0) return gnutls_assert_val(ret); /* make rnd a multiple of blocksize */ if (session->security_parameters.version == GNUTLS_SSL3 || random_pad == 0) { rnd = 0; } else { rnd = (rnd / blocksize) * blocksize; /* added to avoid the case of pad calculated 0 * seen below for pad calculation. */ if (rnd > blocksize) rnd -= blocksize; } length = data_size + hash_size; *pad = (uint8_t) (blocksize - (length % blocksize)) + rnd; length += *pad; if (_gnutls_version_has_explicit_iv (session->security_parameters.version)) length += blocksize; /* for the IV */ break; default: return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); } return length; }
DoS Mem. Corr.
0
calc_enc_length (gnutls_session_t session, int data_size, int hash_size, uint8_t * pad, int random_pad, unsigned block_algo, unsigned auth_cipher, uint16_t blocksize) { uint8_t rnd; unsigned int length; int ret; *pad = 0; switch (block_algo) { case CIPHER_STREAM: length = data_size + hash_size; if (auth_cipher) length += AEAD_EXPLICIT_DATA_SIZE; break; case CIPHER_BLOCK: ret = _gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1); if (ret < 0) return gnutls_assert_val(ret); /* make rnd a multiple of blocksize */ if (session->security_parameters.version == GNUTLS_SSL3 || random_pad == 0) { rnd = 0; } else { rnd = (rnd / blocksize) * blocksize; /* added to avoid the case of pad calculated 0 * seen below for pad calculation. */ if (rnd > blocksize) rnd -= blocksize; } length = data_size + hash_size; *pad = (uint8_t) (blocksize - (length % blocksize)) + rnd; length += *pad; if (_gnutls_version_has_explicit_iv (session->security_parameters.version)) length += blocksize; /* for the IV */ break; default: return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); } return length; }
@@ -354,7 +354,7 @@ compressed_to_ciphertext (gnutls_session_t session, ret = _gnutls_rnd (GNUTLS_RND_NONCE, data_ptr, blocksize); if (ret < 0) return gnutls_assert_val(ret); - + _gnutls_auth_cipher_setiv(&params->write.cipher_state, data_ptr, blocksize); data_ptr += blocksize; @@ -509,7 +509,7 @@ ciphertext_to_compressed (gnutls_session_t session, break; case CIPHER_BLOCK: - if (ciphertext->size < MAX(blocksize, tag_size) || (ciphertext->size % blocksize != 0)) + if (ciphertext->size < blocksize || (ciphertext->size % blocksize != 0)) return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH); /* ignore the IV in TLS 1.1+ @@ -521,14 +521,11 @@ ciphertext_to_compressed (gnutls_session_t session, ciphertext->size -= blocksize; ciphertext->data += blocksize; - - if (ciphertext->size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext->size < tag_size) + return gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED); + /* we don't use the auth_cipher interface here, since * TLS with block ciphers is impossible to be used under such * an API. (the length of plaintext is required to calculate @@ -541,6 +538,7 @@ ciphertext_to_compressed (gnutls_session_t session, pad = ciphertext->data[ciphertext->size - 1] + 1; /* pad */ + if ((int) pad > (int) ciphertext->size - tag_size) { gnutls_assert ();
CWE-310
null
null
9,016
_gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, size_t ciphertext_size, uint8_t * data, size_t max_data_size, content_type_t type, record_parameters_st * params) { gnutls_datum_t gtxt; gnutls_datum_t gcipher; int ret; if (ciphertext_size == 0) return 0; gcipher.size = ciphertext_size; gcipher.data = ciphertext; ret = _gnutls_ciphertext2compressed (session, data, max_data_size, gcipher, type, params); if (ret < 0) { return ret; } if (ret == 0 || is_read_comp_null (session) == 0) { /* ret == ret */ } else { gnutls_datum_t gcomp; /* compression has this malloc overhead. */ gcomp.data = data; gcomp.size = ret; ret = _gnutls_m_compressed2plaintext (session, &gtxt, &gcomp, params); if (ret < 0) { return ret; } if (gtxt.size > MAX_RECORD_RECV_SIZE) { gnutls_assert (); _gnutls_free_datum (&gtxt); /* This shouldn't have happen and * is a TLS fatal error. */ return GNUTLS_E_DECOMPRESSION_FAILED; } /* This check is not really needed */ if (max_data_size < MAX_RECORD_RECV_SIZE) { gnutls_assert (); _gnutls_free_datum (&gtxt); return GNUTLS_E_INTERNAL_ERROR; } memcpy (data, gtxt.data, gtxt.size); ret = gtxt.size; _gnutls_free_datum (&gtxt); } return ret; }
DoS Mem. Corr.
0
_gnutls_decrypt (gnutls_session_t session, opaque * ciphertext, size_t ciphertext_size, uint8_t * data, size_t max_data_size, content_type_t type, record_parameters_st * params) { gnutls_datum_t gtxt; gnutls_datum_t gcipher; int ret; if (ciphertext_size == 0) return 0; gcipher.size = ciphertext_size; gcipher.data = ciphertext; ret = _gnutls_ciphertext2compressed (session, data, max_data_size, gcipher, type, params); if (ret < 0) { return ret; } if (ret == 0 || is_read_comp_null (session) == 0) { /* ret == ret */ } else { gnutls_datum_t gcomp; /* compression has this malloc overhead. */ gcomp.data = data; gcomp.size = ret; ret = _gnutls_m_compressed2plaintext (session, &gtxt, &gcomp, params); if (ret < 0) { return ret; } if (gtxt.size > MAX_RECORD_RECV_SIZE) { gnutls_assert (); _gnutls_free_datum (&gtxt); /* This shouldn't have happen and * is a TLS fatal error. */ return GNUTLS_E_DECOMPRESSION_FAILED; } /* This check is not really needed */ if (max_data_size < MAX_RECORD_RECV_SIZE) { gnutls_assert (); _gnutls_free_datum (&gtxt); return GNUTLS_E_INTERNAL_ERROR; } memcpy (data, gtxt.data, gtxt.size); ret = gtxt.size; _gnutls_free_datum (&gtxt); } return ret; }
@@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)
CWE-310
null
null
9,017
calc_enc_length (gnutls_session_t session, int data_size, int hash_size, uint8_t * pad, int random_pad, cipher_type_t block_algo, uint16_t blocksize) { uint8_t rnd; int length, ret; *pad = 0; switch (block_algo) { case CIPHER_STREAM: length = data_size + hash_size; break; case CIPHER_BLOCK: ret = _gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1); if (ret < 0) { gnutls_assert (); return ret; } /* make rnd a multiple of blocksize */ if (session->security_parameters.version == GNUTLS_SSL3 || random_pad == 0) { rnd = 0; } else { rnd = (rnd / blocksize) * blocksize; /* added to avoid the case of pad calculated 0 * seen below for pad calculation. */ if (rnd > blocksize) rnd -= blocksize; } length = data_size + hash_size; *pad = (uint8_t) (blocksize - (length % blocksize)) + rnd; length += *pad; if (_gnutls_version_has_explicit_iv (session->security_parameters.version)) length += blocksize; /* for the IV */ break; default: gnutls_assert (); return GNUTLS_E_INTERNAL_ERROR; } return length; }
DoS Mem. Corr.
0
calc_enc_length (gnutls_session_t session, int data_size, int hash_size, uint8_t * pad, int random_pad, cipher_type_t block_algo, uint16_t blocksize) { uint8_t rnd; int length, ret; *pad = 0; switch (block_algo) { case CIPHER_STREAM: length = data_size + hash_size; break; case CIPHER_BLOCK: ret = _gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1); if (ret < 0) { gnutls_assert (); return ret; } /* make rnd a multiple of blocksize */ if (session->security_parameters.version == GNUTLS_SSL3 || random_pad == 0) { rnd = 0; } else { rnd = (rnd / blocksize) * blocksize; /* added to avoid the case of pad calculated 0 * seen below for pad calculation. */ if (rnd > blocksize) rnd -= blocksize; } length = data_size + hash_size; *pad = (uint8_t) (blocksize - (length % blocksize)) + rnd; length += *pad; if (_gnutls_version_has_explicit_iv (session->security_parameters.version)) length += blocksize; /* for the IV */ break; default: gnutls_assert (); return GNUTLS_E_INTERNAL_ERROR; } return length; }
@@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)
CWE-310
null
null
9,018
is_read_comp_null (gnutls_session_t session) { record_parameters_st *record_params; _gnutls_epoch_get (session, EPOCH_READ_CURRENT, &record_params); if (record_params->compression_algorithm == GNUTLS_COMP_NULL) return 0; return 1; }
DoS Mem. Corr.
0
is_read_comp_null (gnutls_session_t session) { record_parameters_st *record_params; _gnutls_epoch_get (session, EPOCH_READ_CURRENT, &record_params); if (record_params->compression_algorithm == GNUTLS_COMP_NULL) return 0; return 1; }
@@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)
CWE-310
null
null
9,019
is_write_comp_null (gnutls_session_t session) { record_parameters_st *record_params; _gnutls_epoch_get (session, EPOCH_WRITE_CURRENT, &record_params); if (record_params->compression_algorithm == GNUTLS_COMP_NULL) return 0; return 1; }
DoS Mem. Corr.
0
is_write_comp_null (gnutls_session_t session) { record_parameters_st *record_params; _gnutls_epoch_get (session, EPOCH_WRITE_CURRENT, &record_params); if (record_params->compression_algorithm == GNUTLS_COMP_NULL) return 0; return 1; }
@@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)
CWE-310
null
null
9,020
mac_deinit (digest_hd_st * td, opaque * res, int ver) { if (ver == GNUTLS_SSL3) { /* SSL 3.0 */ _gnutls_mac_deinit_ssl3 (td, res); } else { _gnutls_hmac_deinit (td, res); } }
DoS Mem. Corr.
0
mac_deinit (digest_hd_st * td, opaque * res, int ver) { if (ver == GNUTLS_SSL3) { /* SSL 3.0 */ _gnutls_mac_deinit_ssl3 (td, res); } else { _gnutls_hmac_deinit (td, res); } }
@@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)
CWE-310
null
null
9,021
mac_hash (digest_hd_st * td, void *data, int data_size, int ver) { if (ver == GNUTLS_SSL3) { /* SSL 3.0 */ _gnutls_hash (td, data, data_size); } else { _gnutls_hmac (td, data, data_size); } }
DoS Mem. Corr.
0
mac_hash (digest_hd_st * td, void *data, int data_size, int ver) { if (ver == GNUTLS_SSL3) { /* SSL 3.0 */ _gnutls_hash (td, data, data_size); } else { _gnutls_hmac (td, data, data_size); } }
@@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)
CWE-310
null
null
9,022
make_preamble (opaque * uint64_data, opaque type, uint16_t c_length, opaque ver, opaque * preamble) { opaque minor = _gnutls_version_get_minor (ver); opaque major = _gnutls_version_get_major (ver); opaque *p = preamble; memcpy (p, uint64_data, 8); p += 8; *p = type; p++; if (_gnutls_version_has_variable_padding (ver)) { /* TLS 1.0 or higher */ *p = major; p++; *p = minor; p++; } memcpy (p, &c_length, 2); p += 2; return p - preamble; }
DoS Mem. Corr.
0
make_preamble (opaque * uint64_data, opaque type, uint16_t c_length, opaque ver, opaque * preamble) { opaque minor = _gnutls_version_get_minor (ver); opaque major = _gnutls_version_get_major (ver); opaque *p = preamble; memcpy (p, uint64_data, 8); p += 8; *p = type; p++; if (_gnutls_version_has_variable_padding (ver)) { /* TLS 1.0 or higher */ *p = major; p++; *p = minor; p++; } memcpy (p, &c_length, 2); p += 2; return p - preamble; }
@@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)
CWE-310
null
null
9,023
uscore_to_wincaps (const char *uscore) { last_was_uscore = FALSE; }
DoS Bypass
0
uscore_to_wincaps (const char *uscore) { last_was_uscore = FALSE; }
@@ -42,9 +42,28 @@ typedef struct } DBusGErrorInfo; static GStaticRWLock globals_lock = G_STATIC_RW_LOCK_INIT; +/* See comments in check_property_access */ +static gboolean disable_legacy_property_access = FALSE; static GHashTable *marshal_table = NULL; static GData *error_metadata = NULL; +/* Ugly yes - but we have to accept strings from both formats */ +static gboolean +compare_strings_ignoring_uscore_vs_dash (const char *a, const char *b) +{ + guint i; + + for (i = 0; a[i] && b[i]; i++) + { + if ((a[i] == '-' && b[i] == '_') + || (a[i] == '_' && b[i] == '-')) + continue; + if (a[i] != b[i]) + return FALSE; + } + return (a[i] == '\0') && (b[i] == '\0'); +} + static char* uscore_to_wincaps (const char *uscore) { @@ -270,7 +289,7 @@ method_output_signature_from_object_info (const DBusGObjectInfo *object, } static const char * -propsig_iterate (const char *data, const char **iface, const char **name) +signal_iterate (const char *data, const char **iface, const char **name) { *iface = data; @@ -280,6 +299,108 @@ propsig_iterate (const char *data, const char **iface, const char **name) return string_table_next (data); } +static const char * +property_iterate (const char *data, + int format_version, + const char **iface, + const char **exported_name, + const char **name_uscored, + const char **access_type) +{ + *iface = data; + + data = string_table_next (data); + *exported_name = data; + + data = string_table_next (data); + if (format_version == 1) + { + *name_uscored = data; + data = string_table_next (data); + *access_type = data; + return string_table_next (data); + } + else + { + /* This tells the caller they need to compute it */ + *name_uscored = NULL; + /* We don't know here, however note that we will still check against the + * readable/writable flags from GObject's metadata. + */ + *access_type = "readwrite"; + return data; + } +} + +/** + * property_info_from_object_info: + * @object: introspection data + * @interface_name: (allow-none): Expected interface name, or %NULL for any + * @property_name: Expected property name (can use "-" or "_" as separator) + * @access_type: (out): Can be one of "read", "write", "readwrite" + * + * Look up property introspection data for the given interface/name pair. + * + * Returns: %TRUE if property was found + */ +static gboolean +property_info_from_object_info (const DBusGObjectInfo *object, + const char *interface_name, + const char *property_name, + const char **access_type) +{ + const char *properties_iter; + + properties_iter = object->exported_properties; + while (properties_iter != NULL && *properties_iter) + { + const char *cur_interface_name; + const char *cur_property_name; + const char *cur_uscore_property_name; + const char *cur_access_type; + + + properties_iter = property_iterate (properties_iter, object->format_version, + &cur_interface_name, &cur_property_name, + &cur_uscore_property_name, &cur_access_type); + + if (interface_name && strcmp (interface_name, cur_interface_name) != 0) + continue; + + /* This big pile of ugly is necessary to support the matrix resulting from multiplying + * (v0 data, v1 data) * (FooBar, foo-bar) + * In v1 data we have both forms of string, so we do a comparison against both without + * having to malloc. + * For v0 data, we need to reconstruct the foo-bar form. + * + * Adding to the complexity is that we *also* have to ignore the distinction between + * '-' and '_', because g_object_{get,set} does. + */ + /* First, compare against the primary property name - no malloc required */ + if (!compare_strings_ignoring_uscore_vs_dash (property_name, cur_property_name)) + { + if (cur_uscore_property_name != NULL + && !compare_strings_ignoring_uscore_vs_dash (property_name, cur_uscore_property_name)) + continue; + else + { + /* v0 metadata, construct uscore */ + char *tmp_uscored; + gboolean matches; + tmp_uscored = _dbus_gutils_wincaps_to_uscore (cur_property_name); + matches = compare_strings_ignoring_uscore_vs_dash (property_name, tmp_uscored); + g_free (tmp_uscored); + if (!matches) + continue; + } + } + + *access_type = cur_access_type; + return TRUE; + } + return FALSE; +} + static GQuark dbus_g_object_type_dbus_metadata_quark (void) { @@ -290,11 +411,17 @@ dbus_g_object_type_dbus_metadata_quark (void) return quark; } -static GList * -lookup_object_info (GObject *object) +/* Iterator function should return FALSE to stop iteration, TRUE to continue */ +typedef gboolean (*ForeachObjectInfoFn) (const DBusGObjectInfo *info, + GType gtype, + gpointer user_data); + +static void +foreach_object_info (GObject *object, + ForeachObjectInfoFn callback, + gpointer user_data) { GType *interfaces, *p; - GList *info_list = NULL; const DBusGObjectInfo *info; GType classtype; @@ -304,7 +431,10 @@ lookup_object_info (GObject *object) { info = g_type_get_qdata (*p, dbus_g_object_type_dbus_metadata_quark ()); if (info != NULL && info->format_version >= 0) - info_list = g_list_prepend (info_list, (gpointer) info); + { + if (!callback (info, *p, user_data)) + break; + } } g_free (interfaces); @@ -313,16 +443,85 @@ lookup_object_info (GObject *object) { info = g_type_get_qdata (classtype, dbus_g_object_type_dbus_metadata_quark ()); if (info != NULL && info->format_version >= 0) - info_list = g_list_prepend (info_list, (gpointer) info); + { + if (!callback (info, classtype, user_data)) + break; + } } - /* if needed only: - return g_list_reverse (info_list); - */ - +} + +static gboolean +lookup_object_info_cb (const DBusGObjectInfo *info, + GType gtype, + gpointer user_data) +{ + GList **list = (GList **) user_data; + + *list = g_list_prepend (*list, (gpointer) info); + return TRUE; +} + +static GList * +lookup_object_info (GObject *object) +{ + GList *info_list = NULL; + + foreach_object_info (object, lookup_object_info_cb, &info_list); + return info_list; } +typedef struct { + const char *iface; + const DBusGObjectInfo *info; + gboolean fallback; + GType iface_type; +} LookupObjectInfoByIfaceData; + +static gboolean +lookup_object_info_by_iface_cb (const DBusGObjectInfo *info, + GType gtype, + gpointer user_data) +{ + LookupObjectInfoByIfaceData *lookup_data = (LookupObjectInfoByIfaceData *) user_data; + + /* If interface is not specified, choose the first info */ + if (lookup_data->fallback && (!lookup_data->iface || strlen (lookup_data->iface) == 0)) + { + lookup_data->info = info; + lookup_data->iface_type = gtype; + } + else if (info->exported_properties && !strcmp (info->exported_properties, lookup_data->iface)) + { + lookup_data->info = info; + lookup_data->iface_type = gtype; + } + + return !lookup_data->info; +} + +static const DBusGObjectInfo * +lookup_object_info_by_iface (GObject *object, + const char *iface, + gboolean fallback, + GType *out_iface_type) +{ + LookupObjectInfoByIfaceData data; + + data.iface = iface; + data.info = NULL; + data.fallback = fallback; + data.iface_type = 0; + + foreach_object_info (object, lookup_object_info_by_iface_cb, &data); + + if (out_iface_type && data.info) + *out_iface_type = data.iface_type; + + return data.info; +} + static void gobject_unregister_function (DBusConnection *connection, void *user_data) @@ -443,30 +642,41 @@ write_interface (gpointer key, gpointer val, gpointer user_data) for (; properties; properties = properties->next) { + const char *iface; const char *propname; + const char *propname_uscore; + const char *access_type; GParamSpec *spec; char *dbus_type; gboolean can_set; gboolean can_get; char *s; - propname = properties->data; spec = NULL; - s = _dbus_gutils_wincaps_to_uscore (propname); + property_iterate (properties->data, object_info->format_version, &iface, &propname, &propname_uscore, &access_type); - spec = g_object_class_find_property (g_type_class_peek (data->gtype), s); + if (!propname_uscore) + { + char *s = _dbus_gutils_wincaps_to_uscore (propname); + spec = g_object_class_find_property (g_type_class_peek (data->gtype), s); + g_free (s); + } + else + { + spec = g_object_class_find_property (g_type_class_peek (data->gtype), propname_uscore); + } g_assert (spec != NULL); - g_free (s); - + dbus_type = _dbus_gtype_to_signature (G_PARAM_SPEC_VALUE_TYPE (spec)); g_assert (dbus_type != NULL); - - can_set = ((spec->flags & G_PARAM_WRITABLE) != 0 && - (spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0); - + + can_set = strcmp (access_type, "readwrite") == 0 + && ((spec->flags & G_PARAM_WRITABLE) != 0 + && (spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0); + can_get = (spec->flags & G_PARAM_READABLE) != 0; - + if (can_set || can_get) { g_string_append_printf (xml, " <property name=\"%s\" ", propname); @@ -486,10 +696,8 @@ write_interface (gpointer key, gpointer val, gpointer user_data) g_string_append (xml, "\"/>\n"); } - - g_free (dbus_type); - g_string_append (xml, " </property>\n"); + g_free (dbus_type); } g_slist_free (values->properties); @@ -556,7 +764,7 @@ introspect_interfaces (GObject *object, GString *xml) const char *iface; const char *signame; - propsig = propsig_iterate (propsig, &iface, &signame); + propsig = signal_iterate (propsig, &iface, &signame); values = lookup_values (interfaces, iface); values->signals = g_slist_prepend (values->signals, (gpointer) signame); @@ -567,13 +775,15 @@ introspect_interfaces (GObject *object, GString *xml) { const char *iface; const char *propname; + const char *propname_uscore; + const char *access_type; - propsig = propsig_iterate (propsig, &iface, &propname); + propsig = property_iterate (propsig, info->format_version, &iface, &propname, &propname_uscore, &access_type); values = lookup_values (interfaces, iface); - values->properties = g_slist_prepend (values->properties, (gpointer) propname); + values->properties = g_slist_prepend (values->properties, (gpointer)iface); } - + memset (&data, 0, sizeof (data)); data.xml = xml; data.gtype = G_TYPE_FROM_INSTANCE (object); @@ -1271,6 +1481,70 @@ invoke_object_method (GObject *object, goto done; } +static gboolean +check_property_access (DBusConnection *connection, + DBusMessage *message, + GObject *object, + const char *wincaps_propiface, + const char *requested_propname, + const char *uscore_propname, + gboolean is_set) +{ + const DBusGObjectInfo *object_info; + const char *access_type; + DBusMessage *ret; + + if (!is_set && !disable_legacy_property_access) + return TRUE; + + object_info = lookup_object_info_by_iface (object, wincaps_propiface, TRUE, NULL); + if (!object_info) + { + ret = dbus_message_new_error_printf (message, + DBUS_ERROR_ACCESS_DENIED, + "Interface \"%s\" isn't exported (or may not exist), can't access property \"%s\"", + wincaps_propiface, + requested_propname); + dbus_connection_send (connection, ret, NULL); + dbus_message_unref (ret); + return FALSE; + } + + /* Try both forms of property names: "foo_bar" or "FooBar"; for historical + * reasons we accept both. + */ + if (object_info + && !(property_info_from_object_info (object_info, wincaps_propiface, requested_propname, &access_type) + || property_info_from_object_info (object_info, wincaps_propiface, uscore_propname, &access_type))) + { + ret = dbus_message_new_error_printf (message, + DBUS_ERROR_ACCESS_DENIED, + "Property \"%s\" of interface \"%s\" isn't exported (or may not exist)", + requested_propname, + wincaps_propiface); + dbus_connection_send (connection, ret, NULL); + dbus_message_unref (ret); + return FALSE; + } + + if (strcmp (access_type, "readwrite") == 0) + return TRUE; + else if (is_set ? strcmp (access_type, "read") == 0 + : strcmp (access_type, "write") == 0) + { + ret = dbus_message_new_error_printf (message, + DBUS_ERROR_ACCESS_DENIED, + "Property \"%s\" of interface \"%s\" is not %s", + requested_propname, + wincaps_propiface, + is_set ? "settable" : "readable"); + dbus_connection_send (connection, ret, NULL); + dbus_message_unref (ret); + return FALSE; + } + return TRUE; +} + static DBusHandlerResult gobject_message_function (DBusConnection *connection, DBusMessage *message, @@ -1281,8 +1555,8 @@ gobject_message_function (DBusConnection *connection, gboolean setter; gboolean getter; char *s; - const char *wincaps_propname; - /* const char *wincaps_propiface; */ + const char *requested_propname; + const char *wincaps_propiface; DBusMessageIter iter; const DBusGMethodInfo *method; const DBusGObjectInfo *object_info; @@ -1299,7 +1573,8 @@ gobject_message_function (DBusConnection *connection, return invoke_object_method (object, object_info, method, connection, message); /* If no metainfo, we can still do properties and signals - * via standard GLib introspection + * via standard GLib introspection. Note we do now check + * property access against the metainfo if available. */ getter = FALSE; setter = FALSE; @@ -1322,10 +1597,8 @@ gobject_message_function (DBusConnection *connection, g_warning ("Property get or set does not have an interface string as first arg\n"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - /* We never use the interface name; if we did, we'd need to - * remember that it can be empty string for "pick one for me" - */ - /* dbus_message_iter_get_basic (&iter, &wincaps_propiface); */ + + dbus_message_iter_get_basic (&iter, &wincaps_propiface); dbus_message_iter_next (&iter); if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING) @@ -1333,13 +1606,19 @@ gobject_message_function (DBusConnection *connection, g_warning ("Property get or set does not have a property name string as second arg\n"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - dbus_message_iter_get_basic (&iter, &wincaps_propname); + + dbus_message_iter_get_basic (&iter, &requested_propname); dbus_message_iter_next (&iter); - - s = _dbus_gutils_wincaps_to_uscore (wincaps_propname); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), - s); + s = _dbus_gutils_wincaps_to_uscore (requested_propname); + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), s); + + if (!check_property_access (connection, message, object, wincaps_propiface, requested_propname, s, setter)) + { + g_free (s); + return DBUS_HANDLER_RESULT_HANDLED; + } g_free (s); @@ -1364,11 +1643,6 @@ gobject_message_function (DBusConnection *connection, ret = get_object_property (connection, message, object, pspec); } - else - { - g_assert_not_reached (); - ret = NULL; - } g_assert (ret != NULL); @@ -1379,6 +1653,16 @@ gobject_message_function (DBusConnection *connection, dbus_message_unref (ret); return DBUS_HANDLER_RESULT_HANDLED; } + else + { + DBusMessage *ret; + + ret = dbus_message_new_error_printf (message, + DBUS_ERROR_INVALID_ARGS, + "No such property %s", requested_propname); + dbus_connection_send (connection, ret, NULL); + dbus_message_unref (ret); + } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -1497,8 +1781,8 @@ export_signals (DBusGConnection *connection, const GList *info_list, GObject *ob GClosure *closure; char *s; - sigdata = propsig_iterate (sigdata, &iface, &signame); - + sigdata = signal_iterate (sigdata, &iface, &signame); + s = _dbus_gutils_wincaps_to_uscore (signame); id = g_signal_lookup (s, gtype); @@ -1657,6 +1941,32 @@ dbus_g_error_info_free (gpointer p) */ /** + * dbus_glib_global_set_disable_legacy_property_access: + * + * Historically, DBus-GLib allowed read/write access to any property + * regardless of the access flags specified in the introspection XML, + * and regardless of the DBus interface given. + * + * As of version 0.88, DBus-GLib by default allows read-only access to + * every GObject property of an object exported to the bus, regardless + * of whether or not the property is listed in the type info installed + * with dbus_g_object_type_install_info() and regardless of whether + * the correct interface is specified. Write access is denied. + * + * After calling this method, it will be required that the property is + * exported on the given interface, and even read-only access will be + * checked. This method changes behavior globally for the entire + * process. + * + * Since: 0.88 + */ +void +dbus_glib_global_set_disable_legacy_property_access (void) +{ + disable_legacy_property_access = TRUE; +} + +/** * dbus_g_object_type_install_info: * @object_type: #GType for the object * @info: introspection data generated by #dbus-glib-tool @@ -2310,23 +2620,23 @@ _dbus_gobject_test (const char *test_data_dir) sigdata = dbus_glib_internal_test_object_info.exported_signals; g_assert (*sigdata != '\0'); - sigdata = propsig_iterate (sigdata, &iface, &signame); + sigdata = signal_iterate (sigdata, &iface, &signame); g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.MyObject")); g_assert (!strcmp (signame, "Frobnicate")); g_assert (*sigdata != '\0'); - sigdata = propsig_iterate (sigdata, &iface, &signame); + sigdata = signal_iterate (sigdata, &iface, &signame); g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject")); g_assert (!strcmp (signame, "Sig0")); g_assert (*sigdata != '\0'); - sigdata = propsig_iterate (sigdata, &iface, &signame); + sigdata = signal_iterate (sigdata, &iface, &signame); g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject")); g_assert (!strcmp (signame, "Sig1")); g_assert (*sigdata != '\0'); - sigdata = propsig_iterate (sigdata, &iface, &signame); + sigdata = signal_iterate (sigdata, &iface, &signame); g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject")); g_assert (!strcmp (signame, "Sig2")); g_assert (*sigdata == '\0'); - + i = 0; while (i < (int) G_N_ELEMENTS (name_pairs))
CWE-264
null
null
9,024
foo_signal_handler (DBusGProxy *proxy, double d, void *user_data) { n_times_foo_received += 1; g_print ("Got Foo signal\n"); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
DoS Bypass
0
foo_signal_handler (DBusGProxy *proxy, double d, void *user_data) { n_times_foo_received += 1; g_print ("Got Foo signal\n"); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
@@ -268,7 +268,6 @@ increment_async_cb (DBusGProxy *proxy, guint val, GError *error, gpointer data) g_source_remove (exit_timeout); } - static void lose (const char *str, ...) { @@ -313,6 +312,7 @@ main (int argc, char **argv) DBusGProxy *driver; DBusGProxy *proxy; DBusGProxy *proxy2; + DBusGProxy *property_proxy; char **name_list; guint name_list_len; guint i; @@ -1577,7 +1577,10 @@ main (int argc, char **argv) node = description_load_from_string (v_STRING_2, strlen (v_STRING_2), &error); if (!node) - lose_gerror ("Failed to parse introspection data: %s", error); + { + g_printerr ("===\n%s\n===\n", v_STRING_2); + lose_gerror ("Failed to parse introspection data: %s", error); + } found_introspectable = FALSE; found_properties = FALSE; @@ -1595,9 +1598,10 @@ main (int argc, char **argv) { GSList *elt; gboolean found_manyargs; - + gboolean found_no_touching = FALSE; + found_myobject = TRUE; - + found_manyargs = FALSE; for (elt = interface_info_get_methods (iface); elt; elt = elt->next) { @@ -1612,6 +1616,23 @@ main (int argc, char **argv) } if (!found_manyargs) lose ("Missing method org.freedesktop.DBus.GLib.Tests.MyObject.ManyArgs"); + for (elt = interface_info_get_properties (iface); elt; elt = elt->next) + { + PropertyInfo *prop = elt->data; + + if (strcmp (property_info_get_name (prop), "no-touching") == 0) + { + if (property_info_get_access (prop) != PROPERTY_READ) + lose ("property no-touching had incorrect access %d", property_info_get_access (prop)); + else + { + found_no_touching = TRUE; + break; + } + } + } + if (!found_no_touching) + lose ("didn't find property \"no-touching\" in org.freedesktop.DBus.GLib.Tests.MyObject"); } else if (!found_fooobject && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.GLib.Tests.FooObject") == 0) found_fooobject = TRUE; @@ -1623,7 +1644,262 @@ main (int argc, char **argv) lose ("Missing interface"); } g_free (v_STRING_2); - + + /* Properties tests */ + property_proxy = dbus_g_proxy_new_from_proxy (proxy, DBUS_INTERFACE_PROPERTIES, NULL); + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty (1)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "")); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, "testing value"); + if (!dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to complete SetProperty call", error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty no-touching call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, 40); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call for read-only value \"no-touching\""); + g_clear_error (&error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property (again)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling GetProperty (2)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "testing value")); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: SuperStudly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SuperStudly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super-studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super-studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super_studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super_studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on unknown property\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SomeUnknownProperty", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success for GetProperty call of unknown property"); + + g_clear_error (&error); + } + + /* These two are expected to pass unless we call disable_legacy_property_access */ + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"ShouldBeHidden\" property", error); + + g_value_unset (&value); + } + + g_print ("Calling SetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, TRUE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + /* Now, call disable_legacy_property_access */ + + g_assert (proxy == NULL); + proxy = dbus_g_proxy_new_for_name_owner (connection, + "org.freedesktop.DBus.GLib.TestService", + "/org/freedesktop/DBus/GLib/Tests/MyTestObject", + "org.freedesktop.DBus.GLib.Tests.MyObject", + &error); + + if (!dbus_g_proxy_call (proxy, "UnsafeDisableLegacyPropertyAccess", &error, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to invoke UnsafeDisableLegacyPropertyAccess", error); + + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"should-be-hidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"ShouldBeHidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling SetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, FALSE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_object_unref (property_proxy); + property_proxy = NULL; test_terminate_proxy1 = dbus_g_proxy_new_for_name_owner (connection, "org.freedesktop.DBus.GLib.TestService",
CWE-264
null
null
9,025
frobnicate_signal_handler (DBusGProxy *proxy, int val, void *user_data) { n_times_frobnicate_received += 1; g_assert (val == 42); g_print ("Got Frobnicate signal\n"); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
DoS Bypass
0
frobnicate_signal_handler (DBusGProxy *proxy, int val, void *user_data) { n_times_frobnicate_received += 1; g_assert (val == 42); g_print ("Got Frobnicate signal\n"); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
@@ -268,7 +268,6 @@ increment_async_cb (DBusGProxy *proxy, guint val, GError *error, gpointer data) g_source_remove (exit_timeout); } - static void lose (const char *str, ...) { @@ -313,6 +312,7 @@ main (int argc, char **argv) DBusGProxy *driver; DBusGProxy *proxy; DBusGProxy *proxy2; + DBusGProxy *property_proxy; char **name_list; guint name_list_len; guint i; @@ -1577,7 +1577,10 @@ main (int argc, char **argv) node = description_load_from_string (v_STRING_2, strlen (v_STRING_2), &error); if (!node) - lose_gerror ("Failed to parse introspection data: %s", error); + { + g_printerr ("===\n%s\n===\n", v_STRING_2); + lose_gerror ("Failed to parse introspection data: %s", error); + } found_introspectable = FALSE; found_properties = FALSE; @@ -1595,9 +1598,10 @@ main (int argc, char **argv) { GSList *elt; gboolean found_manyargs; - + gboolean found_no_touching = FALSE; + found_myobject = TRUE; - + found_manyargs = FALSE; for (elt = interface_info_get_methods (iface); elt; elt = elt->next) { @@ -1612,6 +1616,23 @@ main (int argc, char **argv) } if (!found_manyargs) lose ("Missing method org.freedesktop.DBus.GLib.Tests.MyObject.ManyArgs"); + for (elt = interface_info_get_properties (iface); elt; elt = elt->next) + { + PropertyInfo *prop = elt->data; + + if (strcmp (property_info_get_name (prop), "no-touching") == 0) + { + if (property_info_get_access (prop) != PROPERTY_READ) + lose ("property no-touching had incorrect access %d", property_info_get_access (prop)); + else + { + found_no_touching = TRUE; + break; + } + } + } + if (!found_no_touching) + lose ("didn't find property \"no-touching\" in org.freedesktop.DBus.GLib.Tests.MyObject"); } else if (!found_fooobject && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.GLib.Tests.FooObject") == 0) found_fooobject = TRUE; @@ -1623,7 +1644,262 @@ main (int argc, char **argv) lose ("Missing interface"); } g_free (v_STRING_2); - + + /* Properties tests */ + property_proxy = dbus_g_proxy_new_from_proxy (proxy, DBUS_INTERFACE_PROPERTIES, NULL); + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty (1)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "")); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, "testing value"); + if (!dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to complete SetProperty call", error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty no-touching call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, 40); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call for read-only value \"no-touching\""); + g_clear_error (&error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property (again)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling GetProperty (2)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "testing value")); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: SuperStudly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SuperStudly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super-studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super-studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super_studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super_studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on unknown property\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SomeUnknownProperty", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success for GetProperty call of unknown property"); + + g_clear_error (&error); + } + + /* These two are expected to pass unless we call disable_legacy_property_access */ + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"ShouldBeHidden\" property", error); + + g_value_unset (&value); + } + + g_print ("Calling SetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, TRUE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + /* Now, call disable_legacy_property_access */ + + g_assert (proxy == NULL); + proxy = dbus_g_proxy_new_for_name_owner (connection, + "org.freedesktop.DBus.GLib.TestService", + "/org/freedesktop/DBus/GLib/Tests/MyTestObject", + "org.freedesktop.DBus.GLib.Tests.MyObject", + &error); + + if (!dbus_g_proxy_call (proxy, "UnsafeDisableLegacyPropertyAccess", &error, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to invoke UnsafeDisableLegacyPropertyAccess", error); + + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"should-be-hidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"ShouldBeHidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling SetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, FALSE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_object_unref (property_proxy); + property_proxy = NULL; test_terminate_proxy1 = dbus_g_proxy_new_for_name_owner (connection, "org.freedesktop.DBus.GLib.TestService",
CWE-264
null
null
9,026
frobnicate_signal_handler_2 (DBusGProxy *proxy, int val, void *user_data) { n_times_frobnicate_received_2 += 1; g_assert (val == 42); g_print ("Got Frobnicate signal (again)\n"); }
DoS Bypass
0
frobnicate_signal_handler_2 (DBusGProxy *proxy, int val, void *user_data) { n_times_frobnicate_received_2 += 1; g_assert (val == 42); g_print ("Got Frobnicate signal (again)\n"); }
@@ -268,7 +268,6 @@ increment_async_cb (DBusGProxy *proxy, guint val, GError *error, gpointer data) g_source_remove (exit_timeout); } - static void lose (const char *str, ...) { @@ -313,6 +312,7 @@ main (int argc, char **argv) DBusGProxy *driver; DBusGProxy *proxy; DBusGProxy *proxy2; + DBusGProxy *property_proxy; char **name_list; guint name_list_len; guint i; @@ -1577,7 +1577,10 @@ main (int argc, char **argv) node = description_load_from_string (v_STRING_2, strlen (v_STRING_2), &error); if (!node) - lose_gerror ("Failed to parse introspection data: %s", error); + { + g_printerr ("===\n%s\n===\n", v_STRING_2); + lose_gerror ("Failed to parse introspection data: %s", error); + } found_introspectable = FALSE; found_properties = FALSE; @@ -1595,9 +1598,10 @@ main (int argc, char **argv) { GSList *elt; gboolean found_manyargs; - + gboolean found_no_touching = FALSE; + found_myobject = TRUE; - + found_manyargs = FALSE; for (elt = interface_info_get_methods (iface); elt; elt = elt->next) { @@ -1612,6 +1616,23 @@ main (int argc, char **argv) } if (!found_manyargs) lose ("Missing method org.freedesktop.DBus.GLib.Tests.MyObject.ManyArgs"); + for (elt = interface_info_get_properties (iface); elt; elt = elt->next) + { + PropertyInfo *prop = elt->data; + + if (strcmp (property_info_get_name (prop), "no-touching") == 0) + { + if (property_info_get_access (prop) != PROPERTY_READ) + lose ("property no-touching had incorrect access %d", property_info_get_access (prop)); + else + { + found_no_touching = TRUE; + break; + } + } + } + if (!found_no_touching) + lose ("didn't find property \"no-touching\" in org.freedesktop.DBus.GLib.Tests.MyObject"); } else if (!found_fooobject && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.GLib.Tests.FooObject") == 0) found_fooobject = TRUE; @@ -1623,7 +1644,262 @@ main (int argc, char **argv) lose ("Missing interface"); } g_free (v_STRING_2); - + + /* Properties tests */ + property_proxy = dbus_g_proxy_new_from_proxy (proxy, DBUS_INTERFACE_PROPERTIES, NULL); + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty (1)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "")); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, "testing value"); + if (!dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to complete SetProperty call", error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty no-touching call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, 40); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call for read-only value \"no-touching\""); + g_clear_error (&error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property (again)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling GetProperty (2)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "testing value")); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: SuperStudly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SuperStudly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super-studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super-studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super_studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super_studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on unknown property\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SomeUnknownProperty", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success for GetProperty call of unknown property"); + + g_clear_error (&error); + } + + /* These two are expected to pass unless we call disable_legacy_property_access */ + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"ShouldBeHidden\" property", error); + + g_value_unset (&value); + } + + g_print ("Calling SetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, TRUE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + /* Now, call disable_legacy_property_access */ + + g_assert (proxy == NULL); + proxy = dbus_g_proxy_new_for_name_owner (connection, + "org.freedesktop.DBus.GLib.TestService", + "/org/freedesktop/DBus/GLib/Tests/MyTestObject", + "org.freedesktop.DBus.GLib.Tests.MyObject", + &error); + + if (!dbus_g_proxy_call (proxy, "UnsafeDisableLegacyPropertyAccess", &error, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to invoke UnsafeDisableLegacyPropertyAccess", error); + + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"should-be-hidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"ShouldBeHidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling SetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, FALSE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_object_unref (property_proxy); + property_proxy = NULL; test_terminate_proxy1 = dbus_g_proxy_new_for_name_owner (connection, "org.freedesktop.DBus.GLib.TestService",
CWE-264
null
null
9,027
increment_async_cb (DBusGProxy *proxy, guint val, GError *error, gpointer data) { if (error) lose_gerror ("Failed to complete (wrapped async) Increment call", error); if (data != NULL) lose ("(wrapped async) Increment call gave unexpected data"); if (val != 43) lose ("(wrapped async) Increment call returned %d, should be 43", val); g_print ("(wrapped async) increment gave \"%d\"\n", val); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
DoS Bypass
0
increment_async_cb (DBusGProxy *proxy, guint val, GError *error, gpointer data) { if (error) lose_gerror ("Failed to complete (wrapped async) Increment call", error); if (data != NULL) lose ("(wrapped async) Increment call gave unexpected data"); if (val != 43) lose ("(wrapped async) Increment call returned %d, should be 43", val); g_print ("(wrapped async) increment gave \"%d\"\n", val); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
@@ -268,7 +268,6 @@ increment_async_cb (DBusGProxy *proxy, guint val, GError *error, gpointer data) g_source_remove (exit_timeout); } - static void lose (const char *str, ...) { @@ -313,6 +312,7 @@ main (int argc, char **argv) DBusGProxy *driver; DBusGProxy *proxy; DBusGProxy *proxy2; + DBusGProxy *property_proxy; char **name_list; guint name_list_len; guint i; @@ -1577,7 +1577,10 @@ main (int argc, char **argv) node = description_load_from_string (v_STRING_2, strlen (v_STRING_2), &error); if (!node) - lose_gerror ("Failed to parse introspection data: %s", error); + { + g_printerr ("===\n%s\n===\n", v_STRING_2); + lose_gerror ("Failed to parse introspection data: %s", error); + } found_introspectable = FALSE; found_properties = FALSE; @@ -1595,9 +1598,10 @@ main (int argc, char **argv) { GSList *elt; gboolean found_manyargs; - + gboolean found_no_touching = FALSE; + found_myobject = TRUE; - + found_manyargs = FALSE; for (elt = interface_info_get_methods (iface); elt; elt = elt->next) { @@ -1612,6 +1616,23 @@ main (int argc, char **argv) } if (!found_manyargs) lose ("Missing method org.freedesktop.DBus.GLib.Tests.MyObject.ManyArgs"); + for (elt = interface_info_get_properties (iface); elt; elt = elt->next) + { + PropertyInfo *prop = elt->data; + + if (strcmp (property_info_get_name (prop), "no-touching") == 0) + { + if (property_info_get_access (prop) != PROPERTY_READ) + lose ("property no-touching had incorrect access %d", property_info_get_access (prop)); + else + { + found_no_touching = TRUE; + break; + } + } + } + if (!found_no_touching) + lose ("didn't find property \"no-touching\" in org.freedesktop.DBus.GLib.Tests.MyObject"); } else if (!found_fooobject && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.GLib.Tests.FooObject") == 0) found_fooobject = TRUE; @@ -1623,7 +1644,262 @@ main (int argc, char **argv) lose ("Missing interface"); } g_free (v_STRING_2); - + + /* Properties tests */ + property_proxy = dbus_g_proxy_new_from_proxy (proxy, DBUS_INTERFACE_PROPERTIES, NULL); + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty (1)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "")); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, "testing value"); + if (!dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to complete SetProperty call", error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty no-touching call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, 40); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call for read-only value \"no-touching\""); + g_clear_error (&error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property (again)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling GetProperty (2)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "testing value")); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: SuperStudly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SuperStudly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super-studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super-studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super_studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super_studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on unknown property\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SomeUnknownProperty", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success for GetProperty call of unknown property"); + + g_clear_error (&error); + } + + /* These two are expected to pass unless we call disable_legacy_property_access */ + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"ShouldBeHidden\" property", error); + + g_value_unset (&value); + } + + g_print ("Calling SetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, TRUE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + /* Now, call disable_legacy_property_access */ + + g_assert (proxy == NULL); + proxy = dbus_g_proxy_new_for_name_owner (connection, + "org.freedesktop.DBus.GLib.TestService", + "/org/freedesktop/DBus/GLib/Tests/MyTestObject", + "org.freedesktop.DBus.GLib.Tests.MyObject", + &error); + + if (!dbus_g_proxy_call (proxy, "UnsafeDisableLegacyPropertyAccess", &error, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to invoke UnsafeDisableLegacyPropertyAccess", error); + + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"should-be-hidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"ShouldBeHidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling SetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, FALSE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_object_unref (property_proxy); + property_proxy = NULL; test_terminate_proxy1 = dbus_g_proxy_new_for_name_owner (connection, "org.freedesktop.DBus.GLib.TestService",
CWE-264
null
null
9,028
increment_received_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer data) { GError *error; guint val; g_assert (!strcmp (data, "moo")); error = NULL; if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_UINT, &val, G_TYPE_INVALID)) lose_gerror ("Failed to complete (async) Increment call", error); if (val != 43) lose ("Increment call returned %d, should be 43", val); g_print ("Async increment gave \"%d\"\n", val); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
DoS Bypass
0
increment_received_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer data) { GError *error; guint val; g_assert (!strcmp (data, "moo")); error = NULL; if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_UINT, &val, G_TYPE_INVALID)) lose_gerror ("Failed to complete (async) Increment call", error); if (val != 43) lose ("Increment call returned %d, should be 43", val); g_print ("Async increment gave \"%d\"\n", val); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
@@ -268,7 +268,6 @@ increment_async_cb (DBusGProxy *proxy, guint val, GError *error, gpointer data) g_source_remove (exit_timeout); } - static void lose (const char *str, ...) { @@ -313,6 +312,7 @@ main (int argc, char **argv) DBusGProxy *driver; DBusGProxy *proxy; DBusGProxy *proxy2; + DBusGProxy *property_proxy; char **name_list; guint name_list_len; guint i; @@ -1577,7 +1577,10 @@ main (int argc, char **argv) node = description_load_from_string (v_STRING_2, strlen (v_STRING_2), &error); if (!node) - lose_gerror ("Failed to parse introspection data: %s", error); + { + g_printerr ("===\n%s\n===\n", v_STRING_2); + lose_gerror ("Failed to parse introspection data: %s", error); + } found_introspectable = FALSE; found_properties = FALSE; @@ -1595,9 +1598,10 @@ main (int argc, char **argv) { GSList *elt; gboolean found_manyargs; - + gboolean found_no_touching = FALSE; + found_myobject = TRUE; - + found_manyargs = FALSE; for (elt = interface_info_get_methods (iface); elt; elt = elt->next) { @@ -1612,6 +1616,23 @@ main (int argc, char **argv) } if (!found_manyargs) lose ("Missing method org.freedesktop.DBus.GLib.Tests.MyObject.ManyArgs"); + for (elt = interface_info_get_properties (iface); elt; elt = elt->next) + { + PropertyInfo *prop = elt->data; + + if (strcmp (property_info_get_name (prop), "no-touching") == 0) + { + if (property_info_get_access (prop) != PROPERTY_READ) + lose ("property no-touching had incorrect access %d", property_info_get_access (prop)); + else + { + found_no_touching = TRUE; + break; + } + } + } + if (!found_no_touching) + lose ("didn't find property \"no-touching\" in org.freedesktop.DBus.GLib.Tests.MyObject"); } else if (!found_fooobject && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.GLib.Tests.FooObject") == 0) found_fooobject = TRUE; @@ -1623,7 +1644,262 @@ main (int argc, char **argv) lose ("Missing interface"); } g_free (v_STRING_2); - + + /* Properties tests */ + property_proxy = dbus_g_proxy_new_from_proxy (proxy, DBUS_INTERFACE_PROPERTIES, NULL); + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty (1)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "")); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, "testing value"); + if (!dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to complete SetProperty call", error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty no-touching call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling SetProperty (1)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, 40); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_VALUE, &value, G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call for read-only value \"no-touching\""); + g_clear_error (&error); + g_value_unset (&value); + } + + g_print ("Calling GetProperty of read-only property (again)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "no-touching", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT)); + g_assert (g_value_get_uint (&value) == 42); + g_value_unset (&value); + } + + g_print ("Calling GetProperty (2)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "this_is_a_string", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING)); + g_assert (!strcmp (g_value_get_string (&value), "testing value")); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: SuperStudly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SuperStudly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super-studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super-studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty: super_studly\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "super_studly", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed to complete GetProperty call", error); + g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE)); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on unknown property\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "SomeUnknownProperty", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success for GetProperty call of unknown property"); + + g_clear_error (&error); + } + + /* These two are expected to pass unless we call disable_legacy_property_access */ + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"ShouldBeHidden\" property", error); + + g_value_unset (&value); + } + + g_print ("Calling SetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, TRUE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy enabled)\n"); + { + GValue value = {0,}; + if (!dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error); + g_assert (G_VALUE_HOLDS_BOOLEAN (&value)); + g_assert (g_value_get_boolean (&value) == FALSE); + g_value_unset (&value); + } + + /* Now, call disable_legacy_property_access */ + + g_assert (proxy == NULL); + proxy = dbus_g_proxy_new_for_name_owner (connection, + "org.freedesktop.DBus.GLib.TestService", + "/org/freedesktop/DBus/GLib/Tests/MyTestObject", + "org.freedesktop.DBus.GLib.Tests.MyObject", + &error); + + if (!dbus_g_proxy_call (proxy, "UnsafeDisableLegacyPropertyAccess", &error, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose_gerror ("Failed to invoke UnsafeDisableLegacyPropertyAccess", error); + + g_object_unref (proxy); + proxy = NULL; + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"should-be-hidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling GetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + if (dbus_g_proxy_call (property_proxy, "Get", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "ShouldBeHidden", + G_TYPE_INVALID, + G_TYPE_VALUE, &value, G_TYPE_INVALID)) + lose ("Unexpected success from GetProperty call of \"ShouldBeHidden\" property"); + g_clear_error (&error); + } + + g_print ("Calling SetProperty on not-exported property (legacy *disabled*)\n"); + { + GValue value = {0,}; + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, FALSE); + if (dbus_g_proxy_call (property_proxy, "Set", &error, + G_TYPE_STRING, "org.freedesktop.DBus.GLib.Tests.MyObject", + G_TYPE_STRING, "should-be-hidden", + G_TYPE_VALUE, &value, + G_TYPE_INVALID, G_TYPE_INVALID)) + lose ("Unexpected success from SetProperty call of \"should-be-hidden\" property"); + g_value_unset (&value); + g_clear_error (&error); + } + + g_object_unref (property_proxy); + property_proxy = NULL; test_terminate_proxy1 = dbus_g_proxy_new_for_name_owner (connection, "org.freedesktop.DBus.GLib.TestService",
CWE-264
null
null
9,029
SourcePictureClassify (PicturePtr pict, int x, int y, int width, int height) { if (pict->pSourcePict->type == SourcePictTypeSolidFill) { pict->pSourcePict->solidFill.class = SourcePictClassHorizontal; } else if (pict->pSourcePict->type == SourcePictTypeLinear) { PictVector v; xFixed_32_32 l; xFixed_48_16 dx, dy, a, b, off; xFixed_48_16 factors[4]; int i; dx = pict->pSourcePict->linear.p2.x - pict->pSourcePict->linear.p1.x; dy = pict->pSourcePict->linear.p2.y - pict->pSourcePict->linear.p1.y; l = dx * dx + dy * dy; if (l) { a = (dx << 32) / l; b = (dy << 32) / l; } else { a = b = 0; } off = (-a * pict->pSourcePict->linear.p1.x -b * pict->pSourcePict->linear.p1.y) >> 16; for (i = 0; i < 3; i++) { v.vector[0] = IntToxFixed ((i % 2) * (width - 1) + x); v.vector[1] = IntToxFixed ((i / 2) * (height - 1) + y); v.vector[2] = xFixed1; if (pict->transform) { if (!PictureTransformPoint3d (pict->transform, &v)) return SourcePictClassUnknown; } factors[i] = ((a * v.vector[0] + b * v.vector[1]) >> 16) + off; } if (factors[2] == factors[0]) pict->pSourcePict->linear.class = SourcePictClassHorizontal; else if (factors[1] == factors[0]) pict->pSourcePict->linear.class = SourcePictClassVertical; } return pict->pSourcePict->solidFill.class; }
DoS Exec Code Mem. Corr.
0
SourcePictureClassify (PicturePtr pict, int x, int y, int width, int height) { if (pict->pSourcePict->type == SourcePictTypeSolidFill) { pict->pSourcePict->solidFill.class = SourcePictClassHorizontal; } else if (pict->pSourcePict->type == SourcePictTypeLinear) { PictVector v; xFixed_32_32 l; xFixed_48_16 dx, dy, a, b, off; xFixed_48_16 factors[4]; int i; dx = pict->pSourcePict->linear.p2.x - pict->pSourcePict->linear.p1.x; dy = pict->pSourcePict->linear.p2.y - pict->pSourcePict->linear.p1.y; l = dx * dx + dy * dy; if (l) { a = (dx << 32) / l; b = (dy << 32) / l; } else { a = b = 0; } off = (-a * pict->pSourcePict->linear.p1.x -b * pict->pSourcePict->linear.p1.y) >> 16; for (i = 0; i < 3; i++) { v.vector[0] = IntToxFixed ((i % 2) * (width - 1) + x); v.vector[1] = IntToxFixed ((i / 2) * (height - 1) + y); v.vector[2] = xFixed1; if (pict->transform) { if (!PictureTransformPoint3d (pict->transform, &v)) return SourcePictClassUnknown; } factors[i] = ((a * v.vector[0] + b * v.vector[1]) >> 16) + off; } if (factors[2] == factors[0]) pict->pSourcePict->linear.class = SourcePictClassHorizontal; else if (factors[1] == factors[0]) pict->pSourcePict->linear.class = SourcePictClassVertical; } return pict->pSourcePict->solidFill.class; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,030
_gradient_walker_init (GradientWalker *walker, SourcePictPtr pGradient, unsigned int spread) { walker->num_stops = pGradient->gradient.nstops; walker->stops = pGradient->gradient.stops; walker->left_x = 0; walker->right_x = 0x10000; walker->stepper = 0; walker->left_ag = 0; walker->left_rb = 0; walker->right_ag = 0; walker->right_rb = 0; walker->spread = spread; walker->need_reset = TRUE; }
DoS Exec Code Mem. Corr.
0
_gradient_walker_init (GradientWalker *walker, SourcePictPtr pGradient, unsigned int spread) { walker->num_stops = pGradient->gradient.nstops; walker->stops = pGradient->gradient.stops; walker->left_x = 0; walker->right_x = 0x10000; walker->stepper = 0; walker->left_ag = 0; walker->left_rb = 0; walker->right_ag = 0; walker->right_rb = 0; walker->spread = spread; walker->need_reset = TRUE; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,031
_gradient_walker_pixel (GradientWalker *walker, xFixed_32_32 x) { int dist, idist; CARD32 t1, t2, a, color; if (GRADIENT_WALKER_NEED_RESET (walker, x)) _gradient_walker_reset (walker, x); dist = ((int)(x - walker->left_x)*walker->stepper) >> 16; idist = 256 - dist; /* combined INTERPOLATE and premultiply */ t1 = walker->left_rb*idist + walker->right_rb*dist; t1 = (t1 >> 8) & 0xff00ff; t2 = walker->left_ag*idist + walker->right_ag*dist; t2 &= 0xff00ff00; color = t2 & 0xff000000; a = t2 >> 24; t1 = t1*a + 0x800080; t1 = (t1 + ((t1 >> 8) & 0xff00ff)) >> 8; t2 = (t2 >> 8)*a + 0x800080; t2 = (t2 + ((t2 >> 8) & 0xff00ff)); return (color | (t1 & 0xff00ff) | (t2 & 0xff00)); }
DoS Exec Code Mem. Corr.
0
_gradient_walker_pixel (GradientWalker *walker, xFixed_32_32 x) { int dist, idist; CARD32 t1, t2, a, color; if (GRADIENT_WALKER_NEED_RESET (walker, x)) _gradient_walker_reset (walker, x); dist = ((int)(x - walker->left_x)*walker->stepper) >> 16; idist = 256 - dist; /* combined INTERPOLATE and premultiply */ t1 = walker->left_rb*idist + walker->right_rb*dist; t1 = (t1 >> 8) & 0xff00ff; t2 = walker->left_ag*idist + walker->right_ag*dist; t2 &= 0xff00ff00; color = t2 & 0xff000000; a = t2 >> 24; t1 = t1*a + 0x800080; t1 = (t1 + ((t1 >> 8) & 0xff00ff)) >> 8; t2 = (t2 >> 8)*a + 0x800080; t2 = (t2 + ((t2 >> 8) & 0xff00ff)); return (color | (t1 & 0xff00ff) | (t2 & 0xff00)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,032
_gradient_walker_reset (GradientWalker *walker, xFixed_32_32 pos) { int32_t x, left_x, right_x; xRenderColor *left_c, *right_c; int n, count = walker->num_stops; PictGradientStopPtr stops = walker->stops; static const xRenderColor transparent_black = { 0, 0, 0, 0 }; switch (walker->spread) { case RepeatNormal: x = (int32_t)pos & 0xFFFF; for (n = 0; n < count; n++) if (x < stops[n].x) break; if (n == 0) { left_x = stops[count-1].x - 0x10000; left_c = &stops[count-1].color; } else { left_x = stops[n-1].x; left_c = &stops[n-1].color; } if (n == count) { right_x = stops[0].x + 0x10000; right_c = &stops[0].color; } else { right_x = stops[n].x; right_c = &stops[n].color; } left_x += (pos - x); right_x += (pos - x); break; case RepeatPad: for (n = 0; n < count; n++) if (pos < stops[n].x) break; if (n == 0) { left_x = INT_MIN; left_c = &stops[0].color; } else { left_x = stops[n-1].x; left_c = &stops[n-1].color; } if (n == count) { right_x = INT_MAX; right_c = &stops[n-1].color; } else { right_x = stops[n].x; right_c = &stops[n].color; } break; case RepeatReflect: x = (int32_t)pos & 0xFFFF; if ((int32_t)pos & 0x10000) x = 0x10000 - x; for (n = 0; n < count; n++) if (x < stops[n].x) break; if (n == 0) { left_x = -stops[0].x; left_c = &stops[0].color; } else { left_x = stops[n-1].x; left_c = &stops[n-1].color; } if (n == count) { right_x = 0x20000 - stops[n-1].x; right_c = &stops[n-1].color; } else { right_x = stops[n].x; right_c = &stops[n].color; } if ((int32_t)pos & 0x10000) { xRenderColor *tmp_c; int32_t tmp_x; tmp_x = 0x10000 - right_x; right_x = 0x10000 - left_x; left_x = tmp_x; tmp_c = right_c; right_c = left_c; left_c = tmp_c; x = 0x10000 - x; } left_x += (pos - x); right_x += (pos - x); break; default: /* RepeatNone */ for (n = 0; n < count; n++) if (pos < stops[n].x) break; if (n == 0) { left_x = INT_MIN; right_x = stops[0].x; left_c = right_c = (xRenderColor*) &transparent_black; } else if (n == count) { left_x = stops[n-1].x; right_x = INT_MAX; left_c = right_c = (xRenderColor*) &transparent_black; } else { left_x = stops[n-1].x; right_x = stops[n].x; left_c = &stops[n-1].color; right_c = &stops[n].color; } } walker->left_x = left_x; walker->right_x = right_x; walker->left_ag = ((left_c->alpha >> 8) << 16) | (left_c->green >> 8); walker->left_rb = ((left_c->red & 0xff00) << 8) | (left_c->blue >> 8); walker->right_ag = ((right_c->alpha >> 8) << 16) | (right_c->green >> 8); walker->right_rb = ((right_c->red & 0xff00) << 8) | (right_c->blue >> 8); if ( walker->left_x == walker->right_x || ( walker->left_ag == walker->right_ag && walker->left_rb == walker->right_rb ) ) { walker->stepper = 0; } else { int32_t width = right_x - left_x; walker->stepper = ((1 << 24) + width/2)/width; } walker->need_reset = FALSE; }
DoS Exec Code Mem. Corr.
0
_gradient_walker_reset (GradientWalker *walker, xFixed_32_32 pos) { int32_t x, left_x, right_x; xRenderColor *left_c, *right_c; int n, count = walker->num_stops; PictGradientStopPtr stops = walker->stops; static const xRenderColor transparent_black = { 0, 0, 0, 0 }; switch (walker->spread) { case RepeatNormal: x = (int32_t)pos & 0xFFFF; for (n = 0; n < count; n++) if (x < stops[n].x) break; if (n == 0) { left_x = stops[count-1].x - 0x10000; left_c = &stops[count-1].color; } else { left_x = stops[n-1].x; left_c = &stops[n-1].color; } if (n == count) { right_x = stops[0].x + 0x10000; right_c = &stops[0].color; } else { right_x = stops[n].x; right_c = &stops[n].color; } left_x += (pos - x); right_x += (pos - x); break; case RepeatPad: for (n = 0; n < count; n++) if (pos < stops[n].x) break; if (n == 0) { left_x = INT_MIN; left_c = &stops[0].color; } else { left_x = stops[n-1].x; left_c = &stops[n-1].color; } if (n == count) { right_x = INT_MAX; right_c = &stops[n-1].color; } else { right_x = stops[n].x; right_c = &stops[n].color; } break; case RepeatReflect: x = (int32_t)pos & 0xFFFF; if ((int32_t)pos & 0x10000) x = 0x10000 - x; for (n = 0; n < count; n++) if (x < stops[n].x) break; if (n == 0) { left_x = -stops[0].x; left_c = &stops[0].color; } else { left_x = stops[n-1].x; left_c = &stops[n-1].color; } if (n == count) { right_x = 0x20000 - stops[n-1].x; right_c = &stops[n-1].color; } else { right_x = stops[n].x; right_c = &stops[n].color; } if ((int32_t)pos & 0x10000) { xRenderColor *tmp_c; int32_t tmp_x; tmp_x = 0x10000 - right_x; right_x = 0x10000 - left_x; left_x = tmp_x; tmp_c = right_c; right_c = left_c; left_c = tmp_c; x = 0x10000 - x; } left_x += (pos - x); right_x += (pos - x); break; default: /* RepeatNone */ for (n = 0; n < count; n++) if (pos < stops[n].x) break; if (n == 0) { left_x = INT_MIN; right_x = stops[0].x; left_c = right_c = (xRenderColor*) &transparent_black; } else if (n == count) { left_x = stops[n-1].x; right_x = INT_MAX; left_c = right_c = (xRenderColor*) &transparent_black; } else { left_x = stops[n-1].x; right_x = stops[n].x; left_c = &stops[n-1].color; right_c = &stops[n].color; } } walker->left_x = left_x; walker->right_x = right_x; walker->left_ag = ((left_c->alpha >> 8) << 16) | (left_c->green >> 8); walker->left_rb = ((left_c->red & 0xff00) << 8) | (left_c->blue >> 8); walker->right_ag = ((right_c->alpha >> 8) << 16) | (right_c->green >> 8); walker->right_rb = ((right_c->red & 0xff00) << 8) | (right_c->blue >> 8); if ( walker->left_x == walker->right_x || ( walker->left_ag == walker->right_ag && walker->left_rb == walker->right_rb ) ) { walker->stepper = 0; } else { int32_t width = right_x - left_x; walker->stepper = ((1 << 24) + width/2)/width; } walker->need_reset = FALSE; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,033
fbCombineAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 ad; CARD16 as = d >> 24; fbCombineMaskC (&s, &m); ad = ~m; FbByteAddMulC(d, ad, s, as); WRITE(dest + i, d); } }
DoS Exec Code Mem. Corr.
0
fbCombineAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 ad; CARD16 as = d >> 24; fbCombineMaskC (&s, &m); ad = ~m; FbByteAddMulC(d, ad, s, as); WRITE(dest + i, d); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,034
fbCombineAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 src_a = Alpha(s); CARD32 dest_ia = Alpha(~d); FbByteAddMul(s, dest_ia, d, src_a); WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 src_a = Alpha(s); CARD32 dest_ia = Alpha(~d); FbByteAddMul(s, dest_ia, d, src_a); WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,035
fbCombineAtopU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 dest_a = Alpha(d); CARD32 src_ia = Alpha(~s); FbByteAddMul(s, dest_a, d, src_ia); WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineAtopU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 dest_a = Alpha(d); CARD32 src_ia = Alpha(~s); FbByteAddMul(s, dest_a, d, src_ia); WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,036
fbCombineClear (CARD32 *dest, const CARD32 *src, int width) { MEMSET_WRAPPED(dest, 0, width*sizeof(CARD32)); }
DoS Exec Code Mem. Corr.
0
fbCombineClear (CARD32 *dest, const CARD32 *src, int width) { MEMSET_WRAPPED(dest, 0, width*sizeof(CARD32)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,037
fbCombineClearC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { MEMSET_WRAPPED(dest, 0, width*sizeof(CARD32)); }
DoS Exec Code Mem. Corr.
0
fbCombineClearC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { MEMSET_WRAPPED(dest, 0, width*sizeof(CARD32)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,038
fbCombineConjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,039
fbCombineConjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBAtop); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBAtop); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,040
fbCombineConjointAtopU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAAtop); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointAtopU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAAtop); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,041
fbCombineConjointGeneralU (CARD32 *dest, const CARD32 *src, int width, CARD8 combine) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 m,n,o,p; CARD16 Fa, Fb, t, u, v; CARD8 sa = s >> 24; CARD8 da = d >> 24; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: Fa = fbCombineConjointOutPart (sa, da); break; case CombineAIn: Fa = fbCombineConjointInPart (sa, da); break; case CombineA: Fa = 0xff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: Fb = fbCombineConjointOutPart (da, sa); break; case CombineBIn: Fb = fbCombineConjointInPart (da, sa); break; case CombineB: Fb = 0xff; break; } m = FbGen (s,d,0,Fa,Fb,t, u, v); n = FbGen (s,d,8,Fa,Fb,t, u, v); o = FbGen (s,d,16,Fa,Fb,t, u, v); p = FbGen (s,d,24,Fa,Fb,t, u, v); s = m|n|o|p; WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineConjointGeneralU (CARD32 *dest, const CARD32 *src, int width, CARD8 combine) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 m,n,o,p; CARD16 Fa, Fb, t, u, v; CARD8 sa = s >> 24; CARD8 da = d >> 24; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: Fa = fbCombineConjointOutPart (sa, da); break; case CombineAIn: Fa = fbCombineConjointInPart (sa, da); break; case CombineA: Fa = 0xff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: Fb = fbCombineConjointOutPart (da, sa); break; case CombineBIn: Fb = fbCombineConjointInPart (da, sa); break; case CombineB: Fb = 0xff; break; } m = FbGen (s,d,0,Fa,Fb,t, u, v); n = FbGen (s,d,8,Fa,Fb,t, u, v); o = FbGen (s,d,16,Fa,Fb,t, u, v); p = FbGen (s,d,24,Fa,Fb,t, u, v); s = m|n|o|p; WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,042
fbCombineConjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,043
fbCombineConjointInReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBIn); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointInReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBIn); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,044
fbCombineConjointInU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAIn); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointInU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAIn); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,045
fbCombineConjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,046
fbCombineConjointOutU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAOut); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointOutU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAOut); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,047
fbCombineConjointOverReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBOver); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointOverReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBOver); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,048
fbCombineConjointOverU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAOver); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointOverU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAOver); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,049
fbCombineConjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineXor); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineXor); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,050
fbCombineConjointXorU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineXor); }
DoS Exec Code Mem. Corr.
0
fbCombineConjointXorU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineXor); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,051
fbCombineDisjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,052
fbCombineDisjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBAtop); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBAtop); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,053
fbCombineDisjointAtopU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineAAtop); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointAtopU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineAAtop); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,054
fbCombineDisjointGeneralC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width, CARD8 combine) { int i; for (i = 0; i < width; ++i) { CARD32 s, d; CARD32 m,n,o,p; CARD32 Fa, Fb; CARD16 t, u, v; CARD32 sa; CARD8 da; s = READ(src + i); m = READ(mask + i); d = READ(dest + i); da = d >> 24; fbCombineMaskC (&s, &m); sa = m; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: m = fbCombineDisjointInPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointInPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointInPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointInPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: Fa = 0xffffffff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: m = fbCombineDisjointOutPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointOutPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointOutPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointOutPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineBIn: m = fbCombineDisjointInPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointInPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointInPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointInPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineB: Fb = 0xffffffff; break; } m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); s = m|n|o|p; WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointGeneralC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width, CARD8 combine) { int i; for (i = 0; i < width; ++i) { CARD32 s, d; CARD32 m,n,o,p; CARD32 Fa, Fb; CARD16 t, u, v; CARD32 sa; CARD8 da; s = READ(src + i); m = READ(mask + i); d = READ(dest + i); da = d >> 24; fbCombineMaskC (&s, &m); sa = m; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: m = fbCombineDisjointInPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointInPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointInPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointInPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: Fa = 0xffffffff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: m = fbCombineDisjointOutPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointOutPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointOutPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointOutPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineBIn: m = fbCombineDisjointInPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointInPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointInPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointInPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineB: Fb = 0xffffffff; break; } m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); s = m|n|o|p; WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,055
fbCombineDisjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,056
fbCombineDisjointInPart (CARD8 a, CARD8 b) { /* max (1-(1-b)/a,0) */ /* = - min ((1-b)/a - 1, 0) */ /* = 1 - min (1, (1-b)/a) */ b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0; /* 1 - 1 */ return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointInPart (CARD8 a, CARD8 b) { /* max (1-(1-b)/a,0) */ /* = - min ((1-b)/a - 1, 0) */ /* = 1 - min (1, (1-b)/a) */ b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0; /* 1 - 1 */ return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,057
fbCombineDisjointInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,058
fbCombineDisjointInReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBIn); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointInReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBIn); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,059
fbCombineDisjointInU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineAIn); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointInU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineAIn); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,060
fbCombineDisjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,061
fbCombineDisjointOutPart (CARD8 a, CARD8 b) { /* min (1, (1-b) / a) */ b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0xff; /* 1 */ return FbIntDiv(b,a); /* (1-b) / a */ }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointOutPart (CARD8 a, CARD8 b) { /* min (1, (1-b) / a) */ b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0xff; /* 1 */ return FbIntDiv(b,a); /* (1-b) / a */ }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,062
fbCombineDisjointOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,063
fbCombineDisjointOutReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBOut); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointOutReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBOut); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,064
fbCombineDisjointOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,065
fbCombineDisjointOverU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD16 a = s >> 24; if (a != 0x00) { if (a != 0xff) { CARD32 d = READ(dest + i); a = fbCombineDisjointOutPart (d >> 24, a); FbByteMulAdd(d, a, s); s = d; } WRITE(dest + i, s); } } }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointOverU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD16 a = s >> 24; if (a != 0x00) { if (a != 0xff) { CARD32 d = READ(dest + i); a = fbCombineDisjointOutPart (d >> 24, a); FbByteMulAdd(d, a, s); s = d; } WRITE(dest + i, s); } } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,066
fbCombineDisjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,067
fbCombineDisjointXorU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineXor); }
DoS Exec Code Mem. Corr.
0
fbCombineDisjointXorU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineXor); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,068
fbCombineInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD16 a = d >> 24; CARD32 s = 0; if (a) { CARD32 m = READ(mask + i); s = READ(src + i); fbCombineMaskValueC (&s, &m); if (a != 0xff) { FbByteMul(s, a); } } WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD16 a = d >> 24; CARD32 s = 0; if (a) { CARD32 m = READ(mask + i); s = READ(src + i); fbCombineMaskValueC (&s, &m); if (a != 0xff) { FbByteMul(s, a); } } WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,069
fbCombineInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 a; fbCombineMaskAlphaC (&s, &m); a = m; if (a != 0xffffffff) { CARD32 d = 0; if (a) { d = READ(dest + i); FbByteMulC(d, a); } WRITE(dest + i, d); } } }
DoS Exec Code Mem. Corr.
0
fbCombineInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 a; fbCombineMaskAlphaC (&s, &m); a = m; if (a != 0xffffffff) { CARD32 d = 0; if (a) { d = READ(dest + i); FbByteMulC(d, a); } WRITE(dest + i, d); } } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,070
fbCombineInReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 a = Alpha(READ(src + i)); FbByteMul(d, a); WRITE(dest + i, d); } }
DoS Exec Code Mem. Corr.
0
fbCombineInReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 a = Alpha(READ(src + i)); FbByteMul(d, a); WRITE(dest + i, d); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,071
fbCombineInU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 a = Alpha(READ(dest + i)); FbByteMul(s, a); WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineInU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 a = Alpha(READ(dest + i)); FbByteMul(s, a); WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,072
fbCombineMaskAlphaC (const CARD32 *src, CARD32 *mask) { CARD32 a = READ(mask); CARD32 x; if (!a) return; x = READ(src) >> 24; if (x == 0xff) return; if (a == 0xffffffff) { x = x >> 24; x |= x << 8; x |= x << 16; WRITE(mask, x); return; } FbByteMul(a, x); WRITE(mask, a); }
DoS Exec Code Mem. Corr.
0
fbCombineMaskAlphaC (const CARD32 *src, CARD32 *mask) { CARD32 a = READ(mask); CARD32 x; if (!a) return; x = READ(src) >> 24; if (x == 0xff) return; if (a == 0xffffffff) { x = x >> 24; x |= x << 8; x |= x << 16; WRITE(mask, x); return; } FbByteMul(a, x); WRITE(mask, a); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,073
fbCombineMaskU (CARD32 *src, const CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 a = READ(mask + i) >> 24; CARD32 s = READ(src + i); FbByteMul(s, a); WRITE(src + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineMaskU (CARD32 *src, const CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 a = READ(mask + i) >> 24; CARD32 s = READ(src + i); FbByteMul(s, a); WRITE(src + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,074
fbCombineMaskValueC (CARD32 *src, const CARD32 *mask) { CARD32 a = READ(mask); CARD32 x; if (!a) { WRITE(src, 0); return; } if (a == 0xffffffff) return; x = READ(src); FbByteMulC(x, a); WRITE(src,x); }
DoS Exec Code Mem. Corr.
0
fbCombineMaskValueC (CARD32 *src, const CARD32 *mask) { CARD32 a = READ(mask); CARD32 x; if (!a) { WRITE(src, 0); return; } if (a == 0xffffffff) return; x = READ(src); FbByteMulC(x, a); WRITE(src,x); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,075
fbCombineOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD16 a = ~d >> 24; CARD32 s = 0; if (a) { CARD32 m = READ(mask + i); s = READ(src + i); fbCombineMaskValueC (&s, &m); if (a != 0xff) { FbByteMul(s, a); } } WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD16 a = ~d >> 24; CARD32 s = 0; if (a) { CARD32 m = READ(mask + i); s = READ(src + i); fbCombineMaskValueC (&s, &m); if (a != 0xff) { FbByteMul(s, a); } } WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,076
fbCombineOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 a; fbCombineMaskAlphaC (&s, &m); a = ~m; if (a != 0xffffffff) { CARD32 d = 0; if (a) { d = READ(dest + i); FbByteMulC(d, a); } WRITE(dest + i, d); } } }
DoS Exec Code Mem. Corr.
0
fbCombineOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 a; fbCombineMaskAlphaC (&s, &m); a = ~m; if (a != 0xffffffff) { CARD32 d = 0; if (a) { d = READ(dest + i); FbByteMulC(d, a); } WRITE(dest + i, d); } } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,077
fbCombineOutReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 a = Alpha(~READ(src + i)); FbByteMul(d, a); WRITE(dest + i, d); } }
DoS Exec Code Mem. Corr.
0
fbCombineOutReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 a = Alpha(~READ(src + i)); FbByteMul(d, a); WRITE(dest + i, d); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,078
fbCombineOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 a; fbCombineMaskC (&s, &m); a = ~m; if (a != 0xffffffff) { if (a) { CARD32 d = READ(dest + i); FbByteMulAddC(d, a, s); s = d; } WRITE(dest + i, s); } } }
DoS Exec Code Mem. Corr.
0
fbCombineOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 a; fbCombineMaskC (&s, &m); a = ~m; if (a != 0xffffffff) { if (a) { CARD32 d = READ(dest + i); FbByteMulAddC(d, a, s); s = d; } WRITE(dest + i, s); } } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,079
fbCombineOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 a = ~d >> 24; if (a) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); fbCombineMaskValueC (&s, &m); if (a != 0xff) { FbByteMulAdd(s, a, d); } WRITE(dest + i, s); } } }
DoS Exec Code Mem. Corr.
0
fbCombineOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 a = ~d >> 24; if (a) { CARD32 s = READ(src + i); CARD32 m = READ(mask + i); fbCombineMaskValueC (&s, &m); if (a != 0xff) { FbByteMulAdd(s, a, d); } WRITE(dest + i, s); } } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,080
fbCombineOverReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 ia = Alpha(~READ(dest + i)); FbByteMulAdd(s, ia, d); WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineOverReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 ia = Alpha(~READ(dest + i)); FbByteMulAdd(s, ia, d); WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,081
fbCombineSaturateU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD16 sa, da; sa = s >> 24; da = ~d >> 24; if (sa > da) { sa = FbIntDiv(da, sa); FbByteMul(s, sa); } FbByteAdd(d, s); WRITE(dest + i, d); } }
DoS Exec Code Mem. Corr.
0
fbCombineSaturateU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD16 sa, da; sa = s >> 24; da = ~d >> 24; if (sa > da) { sa = FbIntDiv(da, sa); FbByteMul(s, sa); } FbByteAdd(d, s); WRITE(dest + i, d); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,082
fbCombineSrcU (CARD32 *dest, const CARD32 *src, int width) { MEMCPY_WRAPPED(dest, src, width*sizeof(CARD32)); }
DoS Exec Code Mem. Corr.
0
fbCombineSrcU (CARD32 *dest, const CARD32 *src, int width) { MEMCPY_WRAPPED(dest, src, width*sizeof(CARD32)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,083
fbCombineXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 ad; CARD16 as = ~d >> 24; fbCombineMaskC (&s, &m); ad = ~m; FbByteAddMulC(d, ad, s, as); WRITE(dest + i, d); } }
DoS Exec Code Mem. Corr.
0
fbCombineXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = READ(dest + i); CARD32 s = READ(src + i); CARD32 m = READ(mask + i); CARD32 ad; CARD16 as = ~d >> 24; fbCombineMaskC (&s, &m); ad = ~m; FbByteAddMulC(d, ad, s, as); WRITE(dest + i, d); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,084
fbCombineXorU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 src_ia = Alpha(~s); CARD32 dest_ia = Alpha(~d); FbByteAddMul(s, dest_ia, d, src_ia); WRITE(dest + i, s); } }
DoS Exec Code Mem. Corr.
0
fbCombineXorU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 src_ia = Alpha(~s); CARD32 dest_ia = Alpha(~d); FbByteAddMul(s, dest_ia, d, src_ia); WRITE(dest + i, s); } }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,085
fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer) { CARD32 *src_buffer = scanline_buffer; CARD32 *dest_buffer = src_buffer + data->width; int i; scanStoreProc store; scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL; unsigned int srcClass = SourcePictClassUnknown; unsigned int maskClass = SourcePictClassUnknown; FbBits *bits; FbStride stride; int xoff, yoff; if (data->op == PictOpClear) fetchSrc = NULL; else if (!data->src->pDrawable) { if (data->src->pSourcePict) { fetchSrc = fbFetchSourcePict; srcClass = SourcePictureClassify (data->src, data->xSrc, data->ySrc, data->width, data->height); } } else if (data->src->alphaMap) fetchSrc = fbFetchExternalAlpha; else if (data->src->repeatType == RepeatNormal && data->src->pDrawable->width == 1 && data->src->pDrawable->height == 1) { fetchSrc = fbFetchSolid; srcClass = SourcePictClassHorizontal; } else if (!data->src->transform && data->src->filter != PictFilterConvolution) fetchSrc = fbFetch; else fetchSrc = fbFetchTransformed; if (data->mask && data->op != PictOpClear) { if (!data->mask->pDrawable) { if (data->mask->pSourcePict) fetchMask = fbFetchSourcePict; } else if (data->mask->alphaMap) { fetchMask = fbFetchExternalAlpha; maskClass = SourcePictureClassify (data->mask, data->xMask, data->yMask, data->width, data->height); } else if (data->mask->repeatType == RepeatNormal && data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1) { fetchMask = fbFetchSolid; maskClass = SourcePictClassHorizontal; } else if (!data->mask->transform && data->mask->filter != PictFilterConvolution) fetchMask = fbFetch; else fetchMask = fbFetchTransformed; } else { fetchMask = NULL; } if (data->dest->alphaMap) { fetchDest = fbFetchExternalAlpha; store = fbStoreExternalAlpha; if (data->op == PictOpClear || data->op == PictOpSrc) fetchDest = NULL; } else { fetchDest = fbFetch; store = fbStore; switch (data->op) { case PictOpClear: case PictOpSrc: fetchDest = NULL; /* fall-through */ case PictOpAdd: case PictOpOver: switch (data->dest->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: store = NULL; break; default: break; } break; } } if (!store) { int bpp; fbGetDrawable (data->dest->pDrawable, bits, stride, bpp, xoff, yoff); } else { bits = NULL; stride = 0; xoff = yoff = 0; } if (fetchSrc && fetchMask && data->mask && data->mask->componentAlpha && PICT_FORMAT_RGB (data->mask->format)) { CARD32 *mask_buffer = dest_buffer + data->width; CombineFuncC compose = composeFunctions.combineC[data->op]; if (!compose) return; for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ if (fetchSrc) { if (fetchMask) { /* fetch mask before source so that fetching of source can be optimized */ fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); if (maskClass == SourcePictClassHorizontal) fetchMask = NULL; } if (srcClass == SourcePictClassHorizontal) { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, 0, 0); fetchSrc = NULL; } else { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, mask_buffer, 0xffffffff); } } else if (fetchMask) { fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); } if (store) { /* fill dest into second half of scanline */ if (fetchDest) fetchDest (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer, 0, 0); /* blend */ compose (dest_buffer, src_buffer, mask_buffer, data->width); /* write back */ store (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); } else { /* blend */ compose (bits + (data->yDest + i+ yoff) * stride + data->xDest + xoff, src_buffer, mask_buffer, data->width); } } } else { CARD32 *src_mask_buffer = 0, *mask_buffer = 0; CombineFuncU compose = composeFunctions.combineU[data->op]; if (!compose) return; if (fetchMask) mask_buffer = dest_buffer + data->width; for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ if (fetchSrc) { if (fetchMask) { /* fetch mask before source so that fetching of source can be optimized */ fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); if (maskClass == SourcePictClassHorizontal) fetchMask = NULL; } if (srcClass == SourcePictClassHorizontal) { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, 0, 0); if (mask_buffer) { fbCombineInU (mask_buffer, src_buffer, data->width); src_mask_buffer = mask_buffer; } else src_mask_buffer = src_buffer; fetchSrc = NULL; } else { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, mask_buffer, 0xff000000); if (mask_buffer) composeFunctions.combineMaskU (src_buffer, mask_buffer, data->width); src_mask_buffer = src_buffer; } } else if (fetchMask) { fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); fbCombineInU (mask_buffer, src_buffer, data->width); src_mask_buffer = mask_buffer; } if (store) { /* fill dest into second half of scanline */ if (fetchDest) fetchDest (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer, 0, 0); /* blend */ compose (dest_buffer, src_mask_buffer, data->width); /* write back */ store (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); } else { /* blend */ compose (bits + (data->yDest + i+ yoff) * stride + data->xDest + xoff, src_mask_buffer, data->width); } } } if (!store) fbFinishAccess (data->dest->pDrawable); }
DoS Exec Code Mem. Corr.
0
fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer) { CARD32 *src_buffer = scanline_buffer; CARD32 *dest_buffer = src_buffer + data->width; int i; scanStoreProc store; scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL; unsigned int srcClass = SourcePictClassUnknown; unsigned int maskClass = SourcePictClassUnknown; FbBits *bits; FbStride stride; int xoff, yoff; if (data->op == PictOpClear) fetchSrc = NULL; else if (!data->src->pDrawable) { if (data->src->pSourcePict) { fetchSrc = fbFetchSourcePict; srcClass = SourcePictureClassify (data->src, data->xSrc, data->ySrc, data->width, data->height); } } else if (data->src->alphaMap) fetchSrc = fbFetchExternalAlpha; else if (data->src->repeatType == RepeatNormal && data->src->pDrawable->width == 1 && data->src->pDrawable->height == 1) { fetchSrc = fbFetchSolid; srcClass = SourcePictClassHorizontal; } else if (!data->src->transform && data->src->filter != PictFilterConvolution) fetchSrc = fbFetch; else fetchSrc = fbFetchTransformed; if (data->mask && data->op != PictOpClear) { if (!data->mask->pDrawable) { if (data->mask->pSourcePict) fetchMask = fbFetchSourcePict; } else if (data->mask->alphaMap) { fetchMask = fbFetchExternalAlpha; maskClass = SourcePictureClassify (data->mask, data->xMask, data->yMask, data->width, data->height); } else if (data->mask->repeatType == RepeatNormal && data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1) { fetchMask = fbFetchSolid; maskClass = SourcePictClassHorizontal; } else if (!data->mask->transform && data->mask->filter != PictFilterConvolution) fetchMask = fbFetch; else fetchMask = fbFetchTransformed; } else { fetchMask = NULL; } if (data->dest->alphaMap) { fetchDest = fbFetchExternalAlpha; store = fbStoreExternalAlpha; if (data->op == PictOpClear || data->op == PictOpSrc) fetchDest = NULL; } else { fetchDest = fbFetch; store = fbStore; switch (data->op) { case PictOpClear: case PictOpSrc: fetchDest = NULL; /* fall-through */ case PictOpAdd: case PictOpOver: switch (data->dest->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: store = NULL; break; default: break; } break; } } if (!store) { int bpp; fbGetDrawable (data->dest->pDrawable, bits, stride, bpp, xoff, yoff); } else { bits = NULL; stride = 0; xoff = yoff = 0; } if (fetchSrc && fetchMask && data->mask && data->mask->componentAlpha && PICT_FORMAT_RGB (data->mask->format)) { CARD32 *mask_buffer = dest_buffer + data->width; CombineFuncC compose = composeFunctions.combineC[data->op]; if (!compose) return; for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ if (fetchSrc) { if (fetchMask) { /* fetch mask before source so that fetching of source can be optimized */ fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); if (maskClass == SourcePictClassHorizontal) fetchMask = NULL; } if (srcClass == SourcePictClassHorizontal) { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, 0, 0); fetchSrc = NULL; } else { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, mask_buffer, 0xffffffff); } } else if (fetchMask) { fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); } if (store) { /* fill dest into second half of scanline */ if (fetchDest) fetchDest (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer, 0, 0); /* blend */ compose (dest_buffer, src_buffer, mask_buffer, data->width); /* write back */ store (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); } else { /* blend */ compose (bits + (data->yDest + i+ yoff) * stride + data->xDest + xoff, src_buffer, mask_buffer, data->width); } } } else { CARD32 *src_mask_buffer = 0, *mask_buffer = 0; CombineFuncU compose = composeFunctions.combineU[data->op]; if (!compose) return; if (fetchMask) mask_buffer = dest_buffer + data->width; for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ if (fetchSrc) { if (fetchMask) { /* fetch mask before source so that fetching of source can be optimized */ fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); if (maskClass == SourcePictClassHorizontal) fetchMask = NULL; } if (srcClass == SourcePictClassHorizontal) { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, 0, 0); if (mask_buffer) { fbCombineInU (mask_buffer, src_buffer, data->width); src_mask_buffer = mask_buffer; } else src_mask_buffer = src_buffer; fetchSrc = NULL; } else { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, mask_buffer, 0xff000000); if (mask_buffer) composeFunctions.combineMaskU (src_buffer, mask_buffer, data->width); src_mask_buffer = src_buffer; } } else if (fetchMask) { fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); fbCombineInU (mask_buffer, src_buffer, data->width); src_mask_buffer = mask_buffer; } if (store) { /* fill dest into second half of scanline */ if (fetchDest) fetchDest (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer, 0, 0); /* blend */ compose (dest_buffer, src_mask_buffer, data->width); /* write back */ store (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); } else { /* blend */ compose (bits + (data->yDest + i+ yoff) * stride + data->xDest + xoff, src_mask_buffer, data->width); } } } if (!store) fbFinishAccess (data->dest->pDrawable); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,086
static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer, CARD32 *mask, CARD32 maskBits) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; fetchProc fetch = fetchProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; bits += y*stride; fetch(bits, x, width, buffer, indexed); fbFinishAccess (pict->pDrawable); }
DoS Exec Code Mem. Corr.
0
static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer, CARD32 *mask, CARD32 maskBits) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; fetchProc fetch = fetchProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; bits += y*stride; fetch(bits, x, width, buffer, indexed); fbFinishAccess (pict->pDrawable); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,087
fbFetchPixel_a1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else a = pixel >> (offset & 0x1f); #endif a = a & 1; a |= a << 1; a |= a << 2; a |= a << 4; return a << 24; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else a = pixel >> (offset & 0x1f); #endif a = a & 1; a |= a << 1; a |= a << 2; a |= a << 4; return a << 24; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,088
fbFetchPixel_a1b1g1r1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) >> 3; g = ((pixel & 0x2) * 0xff) << 7; b = ((pixel & 0x1) * 0xff) << 16; return a|r|g|b; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a1b1g1r1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) >> 3; g = ((pixel & 0x2) * 0xff) << 7; b = ((pixel & 0x1) * 0xff) << 16; return a|r|g|b; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,089
fbFetchPixel_a1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 a,r,g,b; a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (a | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 a,r,g,b; a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (a | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,090
fbFetchPixel_a1r1g1b1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) << 14; g = ((pixel & 0x2) * 0xff) << 7; b = ((pixel & 0x1) * 0xff); return a|r|g|b; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a1r1g1b1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) << 14; g = ((pixel & 0x2) * 0xff) << 7; b = ((pixel & 0x1) * 0xff); return a|r|g|b; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,091
fbFetchPixel_a1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 a,r,g,b; a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (a | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 a,r,g,b; a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (a | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,092
fbFetchPixel_a2b2g2r2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; b = ((pixel & 0x30) * 0x55) >> 6; g = ((pixel & 0x0c) * 0x55) << 6; r = ((pixel & 0x03) * 0x55) << 16; return a|r|g|b; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a2b2g2r2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; b = ((pixel & 0x30) * 0x55) >> 6; g = ((pixel & 0x0c) * 0x55) << 6; r = ((pixel & 0x03) * 0x55) << 16; return a|r|g|b; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,093
fbFetchPixel_a2r2g2b2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; r = ((pixel & 0x30) * 0x55) << 12; g = ((pixel & 0x0c) * 0x55) << 6; b = ((pixel & 0x03) * 0x55); return a|r|g|b; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a2r2g2b2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; r = ((pixel & 0x30) * 0x55) << 12; g = ((pixel & 0x0c) * 0x55) << 6; b = ((pixel & 0x03) * 0x55); return a|r|g|b; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,094
fbFetchPixel_a4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); pixel |= pixel << 4; return pixel << 24; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); pixel |= pixel << 4; return pixel << 24; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,095
fbFetchPixel_a4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 a,r,g,b; a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (a | r | g | b); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD16 *) bits + offset); CARD32 a,r,g,b; a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (a | r | g | b); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,096
fbFetchPixel_a8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); return pixel << 24; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); return pixel << 24; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,097
fbFetchPixel_a8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD32 *)bits + offset); return ((pixel & 0xff000000) | ((pixel >> 16) & 0xff) | (pixel & 0x0000ff00) | ((pixel & 0xff) << 16)); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD32 *)bits + offset); return ((pixel & 0xff000000) | ((pixel >> 16) & 0xff) | (pixel & 0x0000ff00) | ((pixel & 0xff) << 16)); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,098
fbFetchPixel_a8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { return READ((CARD32 *)bits + offset); }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_a8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { return READ((CARD32 *)bits + offset); }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null
9,099
fbFetchPixel_b1g2r1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 r,g,b; b = ((pixel & 0x8) * 0xff) >> 3; g = ((pixel & 0x6) * 0x55) << 7; r = ((pixel & 0x1) * 0xff) << 16; return 0xff000000|r|g|b; }
DoS Exec Code Mem. Corr.
0
fbFetchPixel_b1g2r1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 r,g,b; b = ((pixel & 0x8) * 0xff) >> 3; g = ((pixel & 0x6) * 0x55) << 7; r = ((pixel & 0x1) * 0xff) << 16; return 0xff000000|r|g|b; }
@@ -4308,107 +4308,9 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - RegionRec region; - int n; - BoxPtr pbox; - Bool srcRepeat = FALSE; - Bool maskRepeat = FALSE; - int w, h; - CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; - CARD32 *scanline_buffer = _scanline_buffer; - FbComposeData compose_data; - - if (pSrc->pDrawable) - srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform - && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); - - if (pMask && pMask->pDrawable) - maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform - && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); - - if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) - op = PictOpSrc; - - if (!miComputeCompositeRegion (&region, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - compose_data.op = op; - compose_data.src = pSrc; - compose_data.mask = pMask; - compose_data.dest = pDst; - if (width > SCANLINE_BUFFER_LENGTH) - scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - - n = REGION_NUM_RECTS (&region); - pbox = REGION_RECTS (&region); - while (n--) - { - h = pbox->y2 - pbox->y1; - compose_data.ySrc = pbox->y1 - yDst + ySrc; - compose_data.yMask = pbox->y1 - yDst + yMask; - compose_data.yDest = pbox->y1; - while (h) - { - compose_data.height = h; - w = pbox->x2 - pbox->x1; - compose_data.xSrc = pbox->x1 - xDst + xSrc; - compose_data.xMask = pbox->x1 - xDst + xMask; - compose_data.xDest = pbox->x1; - if (maskRepeat) - { - compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); - if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) - compose_data.height = pMask->pDrawable->height - compose_data.yMask; - } - if (srcRepeat) - { - compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); - if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) - compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; - } - while (w) - { - compose_data.width = w; - if (maskRepeat) - { - compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); - if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) - compose_data.width = pMask->pDrawable->width - compose_data.xMask; - } - if (srcRepeat) - { - compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); - if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) - compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; - } - fbCompositeRect(&compose_data, scanline_buffer); - w -= compose_data.width; - compose_data.xSrc += compose_data.width; - compose_data.xMask += compose_data.width; - compose_data.xDest += compose_data.width; - } - h -= compose_data.height; - compose_data.ySrc += compose_data.height; - compose_data.yMask += compose_data.height; - compose_data.yDest += compose_data.height; - } - pbox++; - } - REGION_UNINIT (pDst->pDrawable->pScreen, &region); - - if (scanline_buffer != _scanline_buffer) - free(scanline_buffer); + return fbComposite (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); } #endif
CWE-189
null
null