コード例 #1
0
ファイル: jp2.c プロジェクト: DCPTools/openjpeg2-cdist
static opj_bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio,
                                opj_jp2_box_t *box)
{
    box->init_pos = cio_tell(cio);
    box->length = cio_read(cio, 4);
    box->type = cio_read(cio, 4);
    if (box->length == 1) {
        if (cio_read(cio, 4) != 0) {
            opj_event_msg(cinfo, EVT_ERROR, "Cannot handle box sizes higher than 2^32\n");
            return OPJ_FALSE;
        }
        box->length = cio_read(cio, 4);
        if (box->length == 0) {
            box->length = cio_numbytesleft(cio) + 12;
        }
    } else if (box->length == 0) {
        box->length = cio_numbytesleft(cio) + 8;
    }
    if (box->length < 0) {
        opj_event_msg(cinfo, EVT_ERROR, "Integer overflow in box->length\n");
        return OPJ_FALSE; /* TODO: actually check jp2_read_boxhdr's return value */
    }

    return OPJ_TRUE;
}
コード例 #2
0
ファイル: jp2.c プロジェクト: kevinpig/MyRepository
static bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box) {
	box->init_pos = cio_tell(cio);
	box->length = cio_read(cio, 4);
	box->type = cio_read(cio, 4);
	if (box->length == 1) {
		if (cio_read(cio, 4) != 0) {
			opj_event_msg(cinfo, EVT_ERROR, "Cannot handle box sizes higher than 2^32\n");
			return false;
		}
		box->length = cio_read(cio, 4);
		if (box->length == 0) 
			box->length = cio_numbytesleft(cio) + 12;
	}
	else if (box->length == 0) {
		box->length = cio_numbytesleft(cio) + 8;
	}
	
	return true;
}
コード例 #3
0
ファイル: jp2.c プロジェクト: Jshauk/sumatrapdf
static opj_bool jp2_read_boxhdr(opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box) {
	box->init_pos = cio_tell(cio);
	box->length = cio_read(cio, 4);
	box->type = cio_read(cio, 4);
	if (box->length == 1) {
		if (cio_read(cio, 4) != 0) {
			opj_event_msg(cinfo, EVT_ERROR, "Cannot handle box sizes higher than 2^32\n");
			return OPJ_FALSE;
		}
		box->length = cio_read(cio, 4);
		if (box->length == 0) 
			box->length = cio_numbytesleft(cio) + 12;
	}
	else if (box->length == 0) {
		box->length = cio_numbytesleft(cio) + 8;
	}
	/* cf. http://code.google.com/p/openjpeg/issues/detail?id=155 */
	if (box->length < 0) {
		opj_event_msg(cinfo, EVT_ERROR, "Integer overflow in box->length\n");
		return OPJ_FALSE; // TODO: actually check jp2_read_boxhdr's return value
	}
	
	return OPJ_TRUE;
}